Please forgive me. This is written out of my head and involves no research. Usually I research things, but it can ruin my train of thought.
In the beginning (Greece, Shakespeare, etc.) theater was a masculine activity. Often society decided that all public appearances by females were immoral. The world was pretty much the same as it now is in Saudi Arabia. Men did things and women stayed home and had babies and cleaned house. If you're my age, you can remember this. Don't go around asking yourself why there were no women composers or painters. Composing and painting are jobs, and women were not allowed to have jobs. Except prostitution, of course. Women were angels or devils with no in between statuses that allowed for holding jobs. Opera singing is also a job.
In the early era of opera the situation was somewhat confusing to follow. In Venice and Mantua women appeared on the stage in female roles. In Rome and the Papal States all roles were played by men with the high voices sung by castrati (men surgically altered to retain their child voices). There were plenty of castrati around to serve in this capacity. Women singing in church was still forbidden in most places. This means lots of cross-dressing in opera, all by men, such as would have occurred in Shakespeare. High voices were preferred, and castrati sang both male and female roles.
The French were violently opposed to the idea of castrating men to provide high singers. Their female roles were always sung by women. Then Napoleon conquered Italy and put a stop to castration there, apparently imparting the French horror over the practice to the Italians. Over the next 100 years the practice died out until eventually there were no living castrati.
By the time of Mozart, who in his person embodied all the musical practices of all the musical centers of Europe of his time, an additional cross-dressing tradition arose: roles for teenage boys were sung in their pre-pubescent high voices and were portrayed by women. The most famous example of this is Cherubino in Le Nozze di Figaro.
Summary--opera seria included roles for castrati, opera buffa did not. There is a very nice role in an opera by Cavalli (Venetian school, heir to Monteverdi, lived before the seria/buffa split--La Calisto--looked the name up) where Jove pretends to be a woman. As Jove he is a baritone, as the female he is a falsetto soprano. Very funny. This is cross-dressing outside the traditional stereotypes, and as far as I know is the only early opera role intended to be sung falsetto.
Rossini came after the invasion by Napoleon. He composed both for castrati and women singing men, with the preponderance being the latter. Women began to replace castrati during this time in the portrayal of heroes in serious opera. It is surprising how few castrato parts there are in Rossini. Women singing male roles is far more frequent.
One wishes to hear the sound of two high voices singing together: I Capuletti e i Montecchi, still always sung by two women; Semiramide. The plot makes one of them a man, the music makes both of them women. DiDonato and Kasarova have kept Capuletti alive, but Semiramide is now very rare now that Marilyn Horne has retired. Women sing these bel canto roles and have since the beginning. Countertenors were not known in Italian opera in any period.
The only part of the cross-dressing tradition that survived into operas composed in the twentieth century is the tradition that teenage boys should be sung by women: Octavian and The Composer.
My sense of the cross-dressing tradition of opera is that it comes from two causes--the original reluctance to allow respectable women to appear in theater, which morphed into the later realization that seeing people portray the other gender was itself a distinct pleasure, a pleasure that works in both directions.
In modern times certain traditions are followed when reviving older operas.
In my youth Handel and Vivaldi revivals involved Marilyn Horne donning masculine attire, including very tall helmets to compensate for her short stature. Alfred Deller was the only known practicing countertenor, and I don't think he sang very much staged opera. This would require research.
I am reminded that Sarah Bernhardt, a French stage actress, portrayed Hamlet. And there is a movie of The Tempest where Helen Mirren plays Prospero.
Then came the countertenor explosion. If there were an opera composed for 6 countertenors (don't worry, there isn't), casting this would no longer be a problem. Some of them are actually good. No woman could achieve the heroic intensity of David Daniels' Giulio Cesare. The new tradition says that if a male role was written for a castrato, it should be sung by a countertenor, but so far the countertenors have not completely displaced the female mezzo-sopranos. It has so far not become a tradition for teenage boys with high voices to be sung by countertenors. The main objective of this revolution seems to be to reduce the amount of cross-dressing in opera.
Which brings us to the problem: society wishes to look down on cross-dressers of either gender in or out of opera, accusing them of doing it on purpose I suppose.
Susan Graham has a song written for her where she complains similarly. She also sings La Grande Duchesse, Iphigenie and Dido to great acclaim. (I almost looked this up. Caught myself in time.) Susan has the additional disadvantage of being tall.
The most spectacular of all operatic cross-dressers is Vesselina Kasarova who I am pleased to say has not complained, at least not in my hearing. She sings Carmen.
And now Elīna Garanča (cannot display her correct name without looking it up) has announced that she is retiring from trouser roles, as they are usually called. She wants to become a Verdi mezzo. My official opinion on this subject is that while Netrebko can truly say that her voice has transitioned to Verdi, Garanča is premature. She has a dark but not a particularly heavy voice. People don't seem to be able to differentiate between the two--a distinction that is vital to the vocal health of the singer. What matters is the actual physical heaviness of the voice, not how heavy you can fake it. This is the same reason Jonas is not ready for Tristan. Elīna Garanča so far has always cancelled on the west coast, so I have not been in the room with her.
After her Cenerentola, Garanča announced a similar retirement from bel canto. She wants to sing only Carmen forever. Perhaps she simply doesn't want to dress up like a boy any more. Sesto in Clemenza could be any age. She mentioned specifically only Cherubino and Octavian. One would prefer to think that major career decisions were not made for reasons of social bigotry.
The Strauss trouser roles, and perhaps others from Romantic repertoire, are not vocally similar to Mozart. Kasarova warns that it is dangerous to sing Octavian too soon. If you're 18 and can sing him, it isn't too soon for Cherubino.
I have friends who don't like to see cross-dressing in opera. I explain that only in England do countertenors have a long tradition. Italian operas were not composed for the male falsetto and don't sound right in their voices. They are establishing turf in the Baroque era, and even I am beginning to like it. I respond well to people reinventing a musical genre.
So for some people everyone should appear in public, and that includes on the stage, in their gender assigned costume. There is even a Google (I googled this, I confess) question that explains that being a countertenor doesn't necessarily have to do with being gay. The thing it most likely relates to is that the particular singer sounds better in his falsetto voice than he does in his natural voice. You can see films on YouTube of Philippe Jaroussky singing in his normal crooner baritone voice. You would never have heard of him singing like this.
Apparently Jaroussky has announced that he does not wish to appear in a female role. I think it is correct to lump this together with Garanča's announcement. The type of vocal issues that arise for Garanča are not relevant to Jaroussky, since there is no established tradition for countertenors and no roles composed for them until Britten. (Footnote: all of Bach's high voice music would have been written for falsettists or boys, but this is not opera. Still not from research.)
Opera is by now an ancient tradition. I attended the 400 years of Orfeo performance. I don't want to get into the sociological ramifications of this issue, but I feel firmly that looking down on the honored cross-dressing tradition of opera is disrespectful of the genre. It's fun. Relax and enjoy it.
The picture at the top is Erwin Schrott in Les Vepres Siciliennes at ROH. For a list of roles that involve cross-dressing see here.