^^
The bay area is not even close to Manhattan in terms of density, and hell, even Manhattan could and would be more dense(and was in the past) if it were more feasible to build at scale there.
A house is a terrible investment even with the mortgage interest deduction and the restrictive zoning laws and other regulations that arbitrary inflate prices by restricting supply. Without government protectionism, real estate is a pretty poor investment, especially in jurisdictions with high property taxes.
Housing is clearly not the 'best and most viable' investment vehicle in an era of low cost index funds, but really it wasn't even a good investment in the old era of blue chip stock investing.
Definitely true in Texas. My property taxes are nearly rent for a 1 bedroom apartment .