Developers build apartments where they can make money from them, in other words where they can rent them for enough that they'll make back their investment. It's very expensive to build housing, so the only way to make the investment back and have low rental prices is to try to make the building costs as low as possible. A big part of those costs is the price of land.
Or, the only places to build houses with reasonable costs are in areas that weren’t already built out with very expensive houses.
Which will tend to be less desirable areas, by definition.
One approach, of course, would be to also make existing houses less expensive/desirable. Notably, wealthy people tend to have the resources to fight efforts to do that.
The other approach is to expand what land is available to build on. I understand that in the UK, farmers consider it a lottery win if they get planning permission for some of their farmland to become housing.
Despite what many in the UK think about it "being full", this is mostly an illusion from how cramped are the parts in which the houses are allowed to go; the country as a whole is mostly undeveloped.
(There are of course other considerations, with "why did you build on a flood plain?" being one of the failure modes in the UK).
Woke activists love the word "systemic" for a reason.
If a bunch of good people acting in good faith produce a result an evil mastermind would want does it matter if they are good? On many levels obviously yes, on some practical levels the system and the incentives still need to change.