Their jokes about assigning gender to babies and to being transgender, dressing in drag, like all of it was a send-up.
Sure, they did punch down if you were a person who were in those groups, but the fact that it was large enough social event to be relevant enough to be a comedy skit on a television show or a movie seen by millions implies that there were some serious things going on back then that they could see and wanted to address.
What the hell was going on that put all of those things in their mind?
In addition to the comments from others, it’s worth remembering that a lot of their humour is timeless. Shakespeare made drag jokes. The handsome cabin boy is as old as sailing.
Basically, taboo is funny - and these subjects have been taboo for most of human history.