The question here is - is the cost difference of a shared bathroom versus a private bathroom the (or a) major factor in not building affordable housing and the answer is almost certainly no. If it's not, then this is just elitistic moralizing from the ivory tower.
Happy to be proven wrong by the way. (non-sarcastic)
Elitistic moralizing? The only ones moralizing here are those that think dorms are inhumane.
Anyway, in most countries we do build social housing, it's not a question of not building at all, it's a question of being able to build more if you spend less on each unit, and that is obviously the case. As you probably know, bathrooms and kitchens are by far the most expensive rooms, so you can definitely save a lot of money if you share them.
Happy to be proven wrong by the way. (non-sarcastic)