I seem to recall that muslim houses have bathrooms for men and women separated, that's where the second question comes from. Basically, did the split only happen in places of entertainment, and why? When?
Any Google search or pop article will tell you that the first gender-segregated bathroom facilities in the modern era date from a 1739 ball in Paris, but that's not quite the whole story. In fact, toilet use was segregated earlier than that. Restaurants in London, for example, had permanent toilet facilities for male patrons only. Women were expected to carry around a sort of premodern Shewee or portable urinal if they were so bold as to venture out in public, or some such. Presumably there would be someplace private to use it if necessary.
You'll notice, of course, the expectation that women seen in public society could afford to buy these ceramic or glass Shewees. Sheila Cavanaugh argues that the development of gender-segregated toilets in 18th and 19th century Europe was a function of highlighting and heightening class divisions through gender policing. The polite and genteel would of course not deign to bare themselves in front of the other gender. She notes that the famous Paris restaurant actually enforced the use of bathrooms by gender by specifying (male) "valets" to guard the men's and (female) "chambermaids" for the women's toilet area.
As late as 1900, Canadian store owner Timothy Eaton was insisting that providing public toilets for women specifically was necessary to his business, since peeing on the go would enable them to shop for longer.
That describes what we might call the origins of the modern, Western public bathroom divide. For the Middle Ages, I can't think of any Latin European examples offhand. However, Muslim legal scholars discussing sea travel give us some insights into normative ideals, although how much that reflects practice is probably an open question.
Scholars express deep concern over the need to keep men and women separate during sea travel despite the essential impossibility in close quarters. Sources present this as very much a question of developing sexual attraction (i.e. not class as discussed above). One strand of legal writing prescribed women not to travel on ships at all (but of course). However, since there were not just women travelers but women ship owners in the medieval Islamic world, others scholars stepped in with provisions. Most typical is the requirement that men and women have different living quarters, period, including male and female slaves. This would include toilet facilities but is not specific. However, scholar al-Mawardi does specify explicitly different bathroom areas "so that [women] are not exposed to view when they need to use them" (trans. Khalilieh)
This question has come up on AskHistorians before and I vaguely recall some discussion of gender-segregated Roman bathhouses, but that is outside my area of knowledge.
I am not familiar with the history of home architecture, sorry. Hopefully someone will be along to answer that part of OP's query.