This excellent answer by Joshua Engel draws a comparison between men dressed as women in Shakespeare-era plays and perspective jumps in modern cinema:
The audience would, of course, have been aware that these characters were portrayed by boys. [...] It worked only because the audience was fully imbued in the trope, and simply accepted it. I think of it as similar to the effect of intercutting in modern cinema: the world doesn't jump perspectives like that, but since you've been trained to accept that as the language of cinema, it doesn't give you even a moment's pause. It's not so much "suspension of disbelief" as genuine belief: that's the way this world works.
Which made me wonder: when did this stop being the norm? In Shakespeare's day, there were no women actors, and all the female characters were portrayed by men, but of course this is no longer the case today. When did women in plays start being portrayed by actual women? For that matter, was the change sudden (perhaps due to a change in law) or was there a more gradual shift?
If a fully multicultural and international answer to this would be too broad, then it's OK to restrict answers to English theatre, which has had (as far as I know) a continuous history between Shakespeare's time and the present day.