What you need is to require new construction to have a certain density along with building standards (sunlight, insulation, etc.).
Just deregulating exposes the land to the whim of the developer’s good will — trusting them not to get the most bang for the buck out of building a slum, which is a fickle guarantee.
If there’s no short term profitability, public sector needs to step in. Housing is infrastructure, it’s crucial to the land’s growth.
If every developer was able to build as much housing as they ever wanted, the quality would go up through competition.
In pretty much every other sector of the economy, the government regulates safety, and quality comes via competition. Housing should be no different.
But because we've artificially throttled the amount of housing that can be built, the best way to improve profits is to push down the quality as the buyers don't really have an alternative