Adding the non-regulatory half, because plenty of outside switches are not driven by the rules at all.
Bathrooms are the smallest room in most houses, and by the time you have fitted a door that swings inward, a basin, a towel rail and a mirror, the wall area next to the door on the inside is often already taken or blocked by the open door itself. The wall on the other side of the same doorway is usually empty.
There is also a genuine convenience argument that people forget once they are used to it going the other way: you light the room before you walk into it, rather than groping along a wall in the dark. Hotels that light the bathroom automatically are solving the same problem with a sensor.
So: regulation explains why it is common in some countries, geometry explains why it survives even where it is not required.