SF also has some of the most ridiculously onerous zoning laws in the country.
A HUGE portion of the city is just giant single family homes or 2-3 story buildings and you are absolutely forbidden from redeveloping them into dense, affordable housing.
Change the zoning laws and developers will gladly build affordable market-rate housing.