Actually, within the context of the Star Trek setting it makes more sense then you'd make it appear here and most of your arguments don't apply to starfleet at all or in a much limited matter. Things like costs and resources are all but irrelvant for example, and most starfleet vessels are quite spacious, mostly to accodomate addtional facilities such as room for families. Of course there were certain vessels that are primarily desgined for combat (Defiant-Class) and are much smaller then stadard vessels beceause they don't have to accomdate aforementioned facilities.
It's very highly doubtful at best that that is the case for the alliance as well, for the reasons that Han described. As I've said, both of my parents were in the Navy, and I (being their civilian dependent) spent most of my time at whatever homeport for whatever ship they happened to be assigned to (or when they were separated by duty stations, whichever one had the shore duty).
It's terribly impractical and unrealistic for Star Trek to portray families the way they did aboard ships, even if they weren't technically a military organization. There are occasional occurrences where a VIP would be aboard a ship, and most ships had a quarters to accommodate them as such, but unless it was family day, or in my case, two Officers were married and high-ranked enough to get around certain restrictions, you almost never saw any ship open to civilians. There'd be the occasional female Sailor or Officer who was pregnant, though they would typically be very well-prepared for ahead of time where said Sailor or Officer would be rotated to a shore installation for the duration of their pregnancy and their mandatory 3 month maternity leave (although when I was born, my Mom told me that wasn't the case, since the military wasn't very considerate to women's needs, being the late 80's and all. She was lucky she was an Officer and that Dad had some pull to get a staff duty for two years in California. Otherwise, she'd have had me in some third world hospital and be expected to report for office the next day.)