Losing the distinctions in those laws would mostly be a net win for society.
For those that address a real need with sex distinction, if any, you can just define things in terms relevant to the law rather than a general purpose “legal gender” and have better laws without externally imposing broad gender labels.
If having a draft is good for society, especially a limited, skills-based draft (one of the things that the selective service system in principle supports), then excluding women from registration for it an exposure is a net loss (even if you might also benefit from excluding or limiting exposure of people who might bear children in the future to the type of mass draft used for, e.g., the world wars.)
> But while we still have such laws there has to be a legal definition of gender
The question was “what is the harm of making legal gender optional?” Obsoleting distinctions in law that are not themselves beneficial is not a harm.
What exactly is the "practicality" behind making legal gender compulsory? What purpose does it serve?
And conversely, what harm is there in making legal gender optional?