I think the issue at hand here is choice, Mr. Bruce. An infant cannot say whether they choose to be considered as "male" or "female" if they have ambiguous genitalia. An adult can. Many things are considered wrong if done to children, while not with adults. As for the hijra and the berdache, they are indeed rare, that is true, and gender roles are, as far as I know, indeed a large part of Indian society. However, it doesn't matter how rare they are; it's how their society at large sees them. I know that you said that hijra were looked down upon, and since I do not actually know the truth of that I shall look it up. I know, however, that the berdache were seen by their entire tribe as a normal function of gender. There were no "issues" with it, in the way that our society at large has "issues" with the idea that there might be more than two genders. In California's early history, a berdache was taken prisoner once by a group of Spanish monks. They took her into a room, undressed her, and, finding that her genitalia were male, tried to reeducate her on her gender. And yes, I am using the idea that sex and gender are different, which is the commonly held definition among physiologists and sexologists. I don't care what the majority of people think about those two words if the educated community are defining them separately. Anyway, she acted embarrassed, and the Spanish monks believed that she was embarrassed because they had revealed that she was really a man. What they failed to understand, according to historian Albert L. Hurtado, was that she was as embarrassed as any woman would be when taken into a room full of men she did not know and stripped. She, like her people, believed herself to be a woman.
And I don't think anyone can deny that religious belief has become strongly entangled with views on homosexuality, bisexuality, transgender, transsexual, etc.