In NYC's case, it also leads to 1.5-2 million people being able to live in the city who otherwise (at market rates) simply would not be able to, period. To flatly assert that it "simply leads" to a shortage in stock (with no other significant effects) -- or that unregulated housing markets don't also have crippling shortages -- is just... weird.
After all - why would you build apartments or rent out existing rooms if you're not going to make money off of it?
This is, of course, completely illogical: just because some apartments are rent-stabilized, that doesn't mean that all of them are, or even a majority of them are. And of course owners will still rent their stabilized apartments -- they may forego some of the niceties of higher-end maintenance, but they'll still rent them.
And in any case, the reality is that while developers in NYC are occasionally forced to build a small portion "affordable" units[1], it doesn't ding their profit margins very much, and they're falling over each other to create new stock, just the same. (Hint: city planners have long been aware that there's an incentive tradeoff that comes with requiring a certain proportion affordable units to be built; that's why they keep this proportion very low, so as to not impact the developer's incentives, very much).
[1] Most of which generally aren't actually affordable to actual low-income residents (due to on some quirks about how "mean income" is defined), but that's another matter.