It's true that affordability isn't poured into concrete, but it is baked into each and every real estate transaction.
A new luxury high rise needs to have x number of affordable units by law. As you point out, it's true that they don't build the affordable units much or any different than their other units.
But, the way the whole financial side of the thing is structured is completely different than it would be if the laws were different.
A home is just as much a mortgage as it is a physical object.