But one can be harmed by being treated differently from another group without being treated worse than that group.
This is just begging the question.Sex segregating schools could be a worse policy all round than not segregating schools (that's a matter of opinion) i.e. it could theoretically be a "harmful" policy. The point is sex-segregation is not discriminatory as long as the boys and the girls are getting equal education/equally good facilities.
Have you ever heard the phrase "separate but equal"?