My first impulse is to observe that panels were once routinely placed in pantrys, cupboards, closets, etc. It often seemed imperative to hide the panel, and was permitted by code. Even today, there is no general rule against this; we don't even define "closet."
We do have a definition of working space, and prohibitions against placing panels in shower spaces ,and closets "such as clothes closets."

A better perspective was when I realised that folks' would have had a different attitude toward their panels if electrical systems weren't so reliable. The fact is, a home's electrical system is largely forgotten about- until something goes wrong.

This site alone has documented hundreds of still-functioning systems that are older than the occupants. My own house has a system essential unchanged since 1940. Likewise, we see countless examples of truly incompetent "improvements" that somehow seem to work for years without problem.

What these facts tell me is that sparkys have been doing a exceptional job, for a very long time.