San Francisco itself is a counterpoint. It's still the densest area of the US outside of Manhattan, despite decades of anti-development NIMBY housing policy. Both the population and the average rent are rising every year.
The old Victorians you see on postcards were built as single-family houses. Most of them are now subdivided into multiple apartments. Many houses in the city have illegally built inlaw apartments in the basement. People live with multiple roommates into their 40s and 50s.
It is true that eventually housing prices become so high they outstrip the ability of the local economy to provide salaries. In the meantime, it massively increases the costs of doing business, the capital requirements necessary to operate any business in the city. So far, venture capitalists have been willing to provide that capital, but that can't last forever. Last time (1999), it ended in a big economic crash.
Further complicating the analysis is rent control: most existing residents aren't forced to leave, because they are legally shielded from rising property values and rents. They are given the reverse, an incentive to stay in place no matter what, because they enjoy an artificially low rent that they cannot possibly replicate in any comparable dwelling. This causes market rents to skyrocket as maintenance costs and profit are shifted by landlords to the few open units they have, subsidizing the long term residents. It's a wealth transfer from "people who have moved recently" to "people who have not moved recently."
Finally, there are tons of people living in tents in San Francisco, which has become a major political issue lately. This is arguably partly due to homeless people from outside the city moving in to take advantage of its extremely generous social welfare programs for the homeless, but it is at least in part due to high housing costs.