To save everyone from having to wade through stack exchange, here is the ultimate link[1]:
"604.8.1.4 Toe Clearance
The front partition and at least one side partition shall provide a toe clearance of 9 inches (230 mm) minimum above the finish floor and 6 inches (150 mm) deep minimum beyond the compartment-side face of the partition, exclusive of partition support members.
EXCEPTION: Toe clearance at the front partition is not required in a compartment greater than 62 inches (1575 mm) deep with a wall-hung water closet or 65 inches (1650 mm) deep with a floor-mounted water closet."
[1] https://up.codes/viewer/ada/chapter/6/plumbing-elements-and-...
Source: was a janitor for a while in my youth.
Those regulations likely there for "decency and safety". E.g. to discourage people having sex, or to make it more obvious if someone passes out. That is: the regulations really are there to make reduce privacy.
There might be good arguments for reducing privacy, but that is still the proximate goal of the rules.
https://travel.stackexchange.com/questions/26620/why-do-publ...