You have the causality in the wrong order. They are the most expensive places on earth because they improve your quality of life, not the other way around. The price is derived from demand which is derived from a desire to have access to many goods, services, and experiences not available in many other places.
I can speak personally to two other cities I've lived in where housing costs are quite high (though lower than SF and Manhattan): DC and Santa Monica / West LA.
My fiancée and I lived in DC for 5 years in a wonderful expat bubble. While I'm am American, the vast majority of our friends were from all around the world and worked at international development organizations. The extra money we paid for housing was worth all the interesting experiences.
Los Angeles is no different. It's easy to find interesting experiences and food through its diverse populations. There is a fundamental aspect to the nature of cities, viz. that there is a good to density itself. It enables humans to get value out of the shear existence of interacting with other humans in interesting ways. You need enough demand for an experience to support the existence of many experiences (e.g. You can't have a live punk music scene in a town of 100 people. Or even if somehow you do bc the entire town loves punk, it will be at the expense of those people being into other interests. Having enough people with enough wealth and distributed across enough interests/cultures/foods/music tastes, etc facilitates access to way more possible experiences. That, at least, I why I love large American cities.
And I guess it also has to do with the phase in your life; I value freedom above goods & services handy. The satisfying experiences I have in cities all over, also cheap as chips cities in Asia and cities & villages in Asia & Europe. For people making so much money it seems that freedom is within reach if only compromise on the place of living is made. But you make a good points; I made/make decisions based on those points as well at some times; just now I value freedom more than other things.