There was a time when the only receptacle found in the bath was in the base of the light. Most of these were of the two-prong variety.

Three prong receptacles, like the one pictured, had but a brief period of use, before the GFCI was invented.

many places date from this time, and still have this arrangement. I believe replacement fixtures are available. Remember that word : REPLACEMENT. new installations still need GFI protection.

Of course, not grounding the receptacle shown, and powering in the manner shown, was as wrong then as it is now.