There are no laws being broken.
Public and private schools set their own rules if you don't like them, you attend somewhere that has rules you like. If you can't attend somewhere else you suck it up and get on with it - high school is six, ultimately meaningless years. All the living starts after high school finishes.
I've heard this ******** so many times. I have the same problem here with one private school for deaf children in the UK that thinks it has the right to ban the use of sign language in the school.
It doesn't seem to care that this breaks several disability discrimination laws and human rights laws. It's not about 'leave if you don't like it'. It's about respecting the basic human rights of children.
Schools brainwash you into thinking they can set any rule they like. Your language shows that. You know as well as I do that government laws override school rules.
Suppose a private school said (extreme example) that its rules said it could cut off a finger for each time a pupil fails to hand in work.
Would you say 'well, it's a private school, either accept it or leave' ?
No, of course you'd say that's illegal, that the school is exceeding its limits to set a rule like that.
That's a clear black and white example. The situation the OP described is a more marginal case. The debate is whether this does indeed breach the overriding system of law and guidelines that the school must operate under.
You can't just claim it doesn't because 'that's the way it's always been'.
Laws have changed since both you and me were at school.
The entire thrust of general western legal movement for the past 150+ years has been towards stripping away rules that forbid people from doing things they are perfectly capable of doing, simply because they are not the 'normal' gender. (voting, becoming priests, entering university, wearing skirts, same sex relationships, becoming nurses etc.)