I disagree with the interpretation of the picture.
To me, it looks like a 3-way switch was used as a simple on/off switch for something.
That has nothing to do with someone receiving a shock. They received a shock because of inadequate grounding of the metal box, and the wire poking out from the side of the switch. I expect the wire was touching the box.
Without seeing the other side of the switch, I can't say if it is a 3 way or not but from the symptom and the picture I see it looks like someone just bypassed it. Stuck one wire in the back wire hole and the other under the screw on the same terminal.
It was a single pole switch that was working. The person who connected it stuck the wire through the top of the water heater and stuck it into the back stab of the switch on the same side as the feed hot. That was as high as I could lift the switch because the wire was too short. It was hard to work on, so the ground was hooked around the ground screw but the screw wasn't tightened. The cover was missing from the switch, too.
I apologize for the quality of the picture. After I broke two $400 phones, I bought a cheap one for $200 and it doesn't take good pictures. I know it's only Canadian money but it was my Canadian money.
As to cords for water heaters, that's a good idea. It eliminates the need for straps, too.
Whatever the switch, I think our short was caused by that wire poking out to the side.
I know not what the switch is for. The wire - if it's going to fit into those push-in ports, can't be larger than #12 (very old switch) or #14 (modern models). Either way, that's too small for a 30-A water heater ... and the disconnect for the heater should open BOTH hot wires.
Use of a cord & plug -even appropriate selected ones- on a water heater contradicts UL's "listing and labeling." UL has not evaluated the wiring compartment size, or the strain relief connector, for use with either flexible cord, or the flat cords used for 30-A clothes dryers.
UL does list some 125-v, 5-gallon water heaters that come from the factory with a cord and plug.
That's the official word. I disagree with it. My personal home's water heater, furnace, and dishwasher are all connected via cords & plugs.