Some housing in the USSR had communal kitchens and bathrooms because they were actually older buildings adapted to house more families (hence the "you'll have to share your house" horror stories told in the West). Other buildings were actually meant to be temporary but lasted more than planned. Most of the housing of the Soviet Union was just plain apartment buildings; the flats might be small by some people's standards, but that was dictated by economic constraints.
I don't know much about China, but I know some regions had multi-family buildings with shared facilities before the revolution. These too were dictated mostly by economic constraints.