You are behind the times if you think current medical practice is to assign a sex to babies with ambiguous genitalia.
Oh, it's still assigned, in most cases. Just with much more thought, hopefully!

"The first step of management is to identify the cause of atypical genitalia. Then, your baby’s healthcare provider will put together a treatment plan and sex assignment based on hormone tests and other test results."
https://my.clevelandclinic.org/healt...uous-genitalia

And YES, lawmakers do need to stay out of it!