There are a ton of requirements placed on what can even qualify as housing.
To stick close to the example, rooming houses (SROs) are effectively illegal in most cities these days. You simply can't have a commercial venture that rents out cheap barebones bedrooms with shared bathrooms. That's due to regulations that were designed to get rid of rooming houses. Bedrooms are also required by law to have a window and closet with doors in many places.
I'll admit that living in a place that looks like a college dorm isn't the best thing, but we are at the point where there is no middle ground between an apartment and a tent on the street.