And to complement @KirAsh4 comment: probably the cause is some voltage / EMI feedback, likely due to the wires and switches.
From what I see, the Pi does not have protective diodes on the inputs like the AVR chips (and Arduino) do. As a result, feedback to the Pi can probably cause the behaviour which you experienced. Try to switch on/off some lights and electrical devices and see the result.
To correct this condition, use a combination of current limiting, filtering and shielding.
You could use for current limiting, a 1K resistor in line with the switch, installed on a PCB inches from the Pi. Also use a low-pass filter made up of another pull-up / pull-down resistor and a capacitor alternatively to the build in PULL-UP and PULL-DOWN resistors of the PI.
Here are some additional links: