It’s a nice thought, but public restrooms in the US are often so shoddily built, let alone maintained, that you’re lucky some doors close at all, let alone lock. I’ve seen some where the doors go almost to the floor, and built in such a way that there is essentially no way to peek though, but those are few and far between.
So, while properly built and maintained restrooms would help people feel safer, punching fascists (not necessarily literally) also helps.