I've given up locking the door when I use the restroom. Typically, I leave it partially open (unless we have guest). It's like time stands still and the sound of the latch is like a huge gong announcing to every person and animal that I am available for questions or companionship. Which results in DH and/or kids asking if I've seen something of theirs, cat paws under the door and dogs snuffling under the door and nudging the handle. My cat usually follows me in and it's one of the few times she likes to be pet. If the dogs are inside I have all three trying to squeeze as close as possible to me, while shoving the others away. Meanwhile, the cat is scowling from the doorway, because the dogs have intruded upon "her" time.
I have to make a very conscious effort to close and lock the door at work, since I'm the only woman here and I'd mortify all the men I work with.