I'm actually on the fence about this. I am very fear in my belief people should use toilets of their sex (which obviously cannot be changed 🙄), but equally there are exceptional circumstances that arise sometimes, which make me reluctant to criminalist it.
If the ladies toilet is broken (or men's), I'd rather someone knock, and all is they can use the toilet, rather than potentially wet themselves/make themselves ill. If a dad is taking his 3yo to the loo and the men's are broken, she may not be able to wait, and is too young to go on by herself.
Similarly if the disabled toilet is out of action, someone might bring a carer into the regular toilets, or the carer might need to bring the person they are caring into the toilets with them.
Then there's things like intervals and shows, where the women's queue is far longer, there's a limited time to get through everyone, and sometimes when the men's queue is done, the women use both. I've seen that happen a few times.
None of this means it's on for trans people to use whichever loo they fancy! I just think criminalising it gets rid of wiggle room where it's needed.