I have seen similar installations that resulted from unusual circumstances. Today's codes forbid such installations from being done today. In one instance, house built about 1915, no electricity available. No indoor plumbing either. Neither was ever expected. Power lines run about 1935, house wired at that time with panel installed in smallest (guest) bedroom. About 1950, central heat and bathroom installed, the same bedroom being converted to the bath. Ergo, the panel is above the tub. Knowing the financial circumstances involved, those people really did about the best they could do. Codes typically do improve safety, but they do not by any means lower costs. Those people are now deceased and I have not been in that house since they died.
not having money is no excuse for not having common sense.
I have seen electrical panels installed in bathrooms of doctors offices. Fairly recent builds too.
Typically, doctor's bathrooms consist of a toilet and a basin. Still not a good idea. Once moved a panel from inside a linen closet in a bathroom. Turned out to be a major rewire. The home had been sold and the new owners made the panel move and rewire part of the deal. Have seen panels in cloths closets, in kitchens over the counter and in garages behind refrigerators or behind junk stacked to the rafters.
Toilet and basin is legal to install panel in Canada. That is a washroom as opposed to a bathroom. If it has a shower or bathtub no panel allowed.
Some of the situations I have seen & heard. Usually professional people. No common sence.
Here is a link that might be useful: Jupiter Blue Access Panels