You are simply rehashing the idea that free market is holy and magic. Instead, housing is inelastic. Also, apartments are non-fungible goods.
Furthermore, they have a ton of externalities. (e.g. access to transportation, shops, workplaces, schools)
All of this breaks every assumption around free market theory. Unsurprisingly, governments intervene heavily in the housing market almost in every developed country. The only exceptions lead to a combination of slumslords exploiting the poorest people and gated communities for the wealthy.
Housing is not inelastic at all. Economists have studied the effects of laws reducing land-use rights, and have found they impose massive social costs, in the form of less housing construction, that leads to less affordable housing.
You mean that decreasing housing supply correlates with increasing price?
Because that's exactly what inelastic demand is: https://www.investopedia.com/terms/e/inelastic.asp
That said, I'm not opposed to the government building cheap housing. I think that's actually the best solution to an undersupply of housing.