Earlier quoted context omitted.
Using a 3 prong extension cable on the charger will prevent this.
How? The (US) charger's only got 2 pins so ground stays unconnected.
if you take the plug part from the brick you'll note that there's only two pins but the button-like thing is a ground
as noted in a sibling, the power adapter extension cable does plumb the ground through (https://www.apple.com/shop/product/mw2n3ll/a/power-adapter-e...)