Many schools do have different hair rules for girls and boys don't they? I think this is partly about smartness and conformity - which is what uniform is partly about, so TBH, it doesn't sound desperately unfair to me to let girls have long hair but not boys.
And uniform and dress codes are also about convention, aren't they? When I was at school, we couldn't wear trousers (even at my first infant school which had no uniform, just a no trousers for girls rule). These days, many schools do let girls wear trousers, but I don't think many have skirts on the uniform list for boys - and I think the majority would find it accaeptable that boys should not allowed to to wear a skirt to school.
And as an absolute extreme example, DDs wouldn't (I sincerely hope) be allowed to go swimming with school in Speedo trunks. And I think it would probably not go down well if a boy turned up to swim in a one-piece costume with a little frill round the waist! The former may be about decency, but the latter is simply about convention.
So, I think describing it as sexual discrimination is a tad U.
Expecting all boys to abide by the same rules is NU. However, if they try to make an older boy tie his hair up and he refuses, I'm not sure that is a reason to follow suit.