For a long time I had trouble believing that anybody could actually be that level of horrible to somebody else's face when they're both ostensibly trying to entertain each other playing a cooperative game. The more I read about others' experiences, though, the more I realize that what I thought was social ineptitude in my own little band of geeks isn't even scratching the surface of just how sad, sick, and clueless people can get. I'm sorry to hear this. But can I assume from the fact that you're still here that your story has a happy ending and you did eventually find a group of decent human beings?
It's often quite difficult to think that some people, especially people who are part of the same general social group (i.e. gamers, geeks, etc.), can be so horrible to other people. Regrettably, I've had enough bad experiences* with people that I tend to assume the worst from them (while hoping for the best, but expecting to ultimately be disappointed by them). After the experience I mentioned, I did refrain from even attempting to get back into D&D for a few months. When I did, I was (understandably) concerned about what kind of people I could find to game with, how I would find them (since I certainly was never going back to the hobby shop where I first met the group that almost made me quit), and whether I should even attempt to make a female character again.
Ultimately, I did find another group to game with who were mostly decent people (although, sadly, one of them did eventually turn skinhead on us and left the group when he saw we weren't going to put up with his racist crap), but I was the GM introducing them to the game, and not playing as I had preferred back then (I still greatly enjoy playing, but I now also enjoy DM-ing as well).
My group changed members over the years as people moved and passed on, and friends of friends were invited to the table. Eventually the people I introduced to the game became confident enough to DM on their own, at which point we would take turns DM-ing, creating campaigns in a kind of round-robin storytelling that merged everyone's styles while allowing everyone to play in turn, and helping the fledgling DMs refine their skills.
I like to think that by persevering in the hobby I've helped mold a handful of new DMs who are open to creative ideas during play and who treat other people with respect and basic human dignity, and that the good I've done in that regard can outweigh the awfulness I've trudged through along the way.
*As a kid I was frequently bullied for my weight, my sexuality, and because my family was basically the poorest family in an upper-middle class neighborhood; also, my two best friends broke into my home and stole a few thousand dollars worth of video games and consoles.
Unfortunately, there's not a whole lot a single game book can do to fix the sad, sick, and clueless. I would like to believe that something in black and white like the PHB's entry on gender could be used as a sort of blunt instrument against a DM who had certain other ideas: you could point to it and say, "The rules allow me to do this, so let me do this!" But really, that's just the same misplaced optimism that made it so hard for me to believe players like that existed in the first place. A-holes are going to be a-holes regardless of some wording on a page. They're likely to reject it offhand, and even if they do acquiesce, that doesn't fix the underlying problem -- they're just going to find some other way to be a-holes. So no, I don't think the wording is there for them. It's there for the rest of us: to encourage those of us who might sometimes feel vulnerable in our lives to give this hobby the try, and to gently remind those of us who aren't committed a-holes but might still occasionally put our feet in our mouths to keep an open mind.
I agree. No statement in a book will prevent horrible behavior. The only thing that will truly do that is members of the gaming community being willing to stand up against it when they see it, instead of joining in or turning a blind eye or a deaf ear.
That said, I do think words in the book can open the minds of those who are decent people but who have just never given much thought to situations and people who are different in the manner described. The words in the book can lead to wondering what life is like for people who are different in that way, and it can lead to less fear of being judged for choosing to play a character who is different in that way (a fear that, admittedly, could be immediately slapped back into the player and magnified if the group she's with decides to treat her badly for that choice).