Square D QOC 12 125: Is it possible to bring this subpanel up to code?
New subpanel time

The reason is, there are several structural issues with how this panel is mounted, so it has to come out anyway.   So you might as well put a proper panel in here. And believe me, it'll be a relief! 

The structural issues are:  


Sheath not extending far enough into panel for most Romex circuits. 
The panel doesn't even have a ground bar, and it's a subpanel 
insanely overfull neutral bar, even before the green grounds were added
cables entering without clamps at all
Box setback from wall surface; it's ok with switches but you're seriously not allowed to do that with service panels what were they thinking?


Separately from that, the panel is way too darn small, and I know this has been impacting your project, in ways that you've just been working around up til now.  Like the insanity with the bathroom outlet feeding a lot of other stuff, I'm sure there's a lot of that going on.  I mean the subpanel got put in in the first place because the main panel was full;  and it's full too. Not good.   You should always have loads of extra space. 

You need to make the call on size, but we beat the drum hard for Big Big Big.  I for one like to see around 48 spaces between both panels. Absent better information I would call for a 30-space.  Space not circuit; a 20-space/40-circuit panel only counts as a 20.  

A main-lug panel will suffice, and you can mount it inverted if the existing wires will not reach.  Bus amperage doesn't matter.   You can stay with Square D "QO" if you want to reuse your breakers and pay 60% above market for any new breakers.  One advantage of QO and Eaton CH is the breakers are only 3/4" tall, so panels are shorter for the same number of breakers. Either get a panel with included ground bars, or add them.  

Retrofit a ground wire between the main panel and subpanel.  The old cable is fine unless you want to up-size it; if you do, go aluminum.  

If you keep it

First, keep in mind that work is not necessarily grandfathered merely because it is old.  It's only grandfathered if it was correct at the time it was installed.  Many a dryer and range circuit is run with /2 w/gnd NM cable, which was never legal. 

If you look at the list at the top, that's pretty much your punchlist.  First and foremost the panel must be de-installed to move it outward so it 1/16" proud of the wall so the cover can bottom out on the panel body. If you want to have little hatches above and below it for access to the wires, that is fine.  Then it either needs to be repositioned so the sheath of each cable can enter the box by at least 1/4", or you need to terminate those cable runs in a junction box above or below, then bring it on into the panel with a jumper. I prefer to connect the junction box with an EMT conduit nipple (short pipe) of about 2" and bring the wires into the panel proper via the EMT.  You might even be able to do it with existing wire length.  

Further, the neutral bar must be addressed.  You can't finish the job with 2 wires in any slot.  Some panel makers allow 3 on ground wires, but nobody allows double-lugging neutrals. I can't see how you can need more than 12 neutrals in a 12-breaker panel, though.  All the grounds need to go, for that and separation reasons.  Quite likely a common Square D ground bar will bolt up to this panel into existing holes, but your Square D dealer will know for sure.  

A Square D dealer means a real electrical supply house.  The big box stores don't even own the correct catalogs, let alone have any experience interpreting them.