Well if it is a 2 wire switch and we connect ground and power when that switch closes the direct short created will let the smoke out of both the switch and that mainboard. Endstops should always be latched to an input pin. And if it is only a 2 wire then it should be latched to gnd and pin..

However, Because Marlin is so darn configurable if we wanted to we could wire the switch to no more than +5v power and the pin so that when the switch closes it sends 5v power to the pin. And then in marlin we can configure that pin so it is latched to a pulldown resistor and reverse it's logic and it will also work. But it is always safer just to play with the ground circuit because it is harder to short off the ground circuit.