If housing represents potential health issues to it's occupants such as lead paint, fire hazard or drastic rodent issues, we generally require those issues to be corrected before it can be sold.
And most cities require those issues to be corrected by the landlord all the time, and if they aren't you have a case to pay your rent in escrow until the problem is fixed.
Is this abused? Sure. But its a lot better than living in a tent on the street where you are guaranteed rodent issues along with far worse health hazards.
The fact that some houses with shared living space in the past had health hazard is not a good argument for banning all such houses. We don't ban Chinese restaurants because some violated health codes, we don't ban station wagons because potheads disproportionately own them, etc.