@kingrat You're missing the fiscal side of things. Public investment in housing used to be much greater, before Prop 13, Reagan, the Faircloth Amendment, end of Redevelopment in California. It doesn't turn a profit to build housing for the non-rich.
In the Mission, activists fought housing for rich people as leverage to win funding for affordable housing. Whether or not you like the tactic, it worked. The City wouldn't have funded all these developments otherwise. https://missionlocal.org/2020/11/an-affordable-housing-boomlet-is-coming-to-the-mission/