Substituting the traditional notions of "sex" for "gender" caused a movement from biological determinism to identity determinism. It caused this bathroom problem.
For instance, if bathrooms are based on "sex," those people with penises have to use the men's room.
If bathrooms are based on "gender," then it becomes self-defined. Gendered people can use whatever bathrooms they want at their whim.
That's why the movement from determinism, i.e., sex, to identity, i.e., gender, made public accommodations law problematic.
It's also why the government does not ask you for your gender anymore, but rather, your sex.