2 doors - one room - access control
I think this procedure works better.

Both doors should stay closed so you need a door closer and alarm if it is stuck open. You should also have a motion sensor inside the bathroom. Handles on both sides of doors should actually be momentary switches.


both doors should be normally locked.  
turning either entry handle should check toidy is not reserved by other room and if not unlock the door and reserve the room. An occupied courtesy light on the outside of both sides would be a nice feature.
On door closing door should lock.   
Motion sensor now checked. If nobody is about, release reserved flag and light and return to state 1.  
exit though entry door now enabled.  
On try open exit door, unlock door and return to state 3.  


Issues: 


What happens when the power goes out?
Is through bathroom path part of the fire plan?  
Have fun explaining to the girls that is a motion sensor and not a camera.
Some sort of Over-ride is needed to allow someone to enter in case occupant has a medical emergency. (which kind of defeats the whole purpose..)
Detecting occupied can be tricky, especially if there is a stall or area that is obscured (shower). Also motion alone can be a problem.. sit still on the can for a while. Been in a few washrooms that had motion activated lights go out while I was doing my business.. and waving arms did not help.