Or find a different way to break up wrestling groups equitably, something along the lines of weight classes. Gender in this case is a proxy for other things that could likely be measured and accounted for. Boys and girls, regardless of birth gender, could compete within the same group. As long as the groups were created by some reasonable capability-measuring standard, I don’t see how that would be a problem.
Same thing with firefighters. Firefighters used to exclude women because the average man has more upper body strength than the average woman. But if the department simply tests upper body strength regardless of gender, some women will pass (and some men will fail).