Long wires causing Raspberry Pi to die?
The wire has inductance and, the longer the wire is the more inductance it has. An inductance likes to maintain the current flowing through itself so, when your switch opens, the small stored energy in the cables magnetic field tries to maintain current flow and produces a sizable voltage (aka back-emf) in doing so. This can easily exceed the maximum voltage rating of your IO pin and pop goes the chip.

The capacitor provides a path to maintain current flow when the switch opens and normally will restrict any voltage spike (back emf) considerably. I have faith in it working but if it doesn't then it could be pick-up from AC power lines or some rogue RF transmitter nearby. In this case use a capacitor and a zener diode rated at a little below your power rail voltage.