A significantly more pressing problem of our legislation is its accessibility. Nobody on this planet needs lawyers defining sex. But they would do it and everyone will have to pay for their time.
Additionally the laws that differentiate sex should be under scrutiny for discrimination. That includes tax discrimination for people within or outside of any partnerships.
That ship sailed the moment sex gained legal significance, which means in many jurisidictions it has always been a subject lawyers can argue over. It's not going to come up most of the time, but for that 0.1% of the population it has and will.
If you don't want lawyers arguing about sex, you would have to get rid of the concept of sex in law, including sex discrimination law.
Either have a problem for less than 0.1% of people, which can be accommodated btw, or have a problem with 99.9% of the public which will cause public order problems.