There's no perfect answer. But the thing is that women's sports exist for a reason: without sex-segregated sports leagues, almost no women would ever have the opportunity to compete at a high level in almost any sport. Not because of their gender identity or expression, but because of their physical differences. Coed contact sports can even be unsafe for women. So the line is drawn very conservatively in order to maintain a reasonably fair, reasonably safe environment where women can compete.
Is it discrimination? I guess it is. But then, sports teams discriminate based on physical characteristics all the time. People with physical or severe mental disabilities are often denied the opportunity to compete for their schools' teams, and may have to play in specialized leagues. Trans boys are legally allowed to play for boys' teams, but that doesn't mean we can meet the physical standards to do so (and unlike for trans girls, puberty blockers don't fix that problem for us). Intersex people may have to compete in male divisions.
Eligibility rules for sports are messy. But having pubescent trans girls on a girls' team is unfair to all of the girls she plays with or against; it's discriminatory against them, and it undermines the whole point of women's sports. They don't exist because of gender or identity. They exist because of differences in physical sex.