Connecting that switch between input and ground won't work because the voltage drop of the LED will be too high.

You could connect that switch to a Duet 3 IO port between +5V and IN, and connect a pulldown resistor of about 470 ohms between IN and ground. That might work for the Duet 2 as well, but the noise margin would be reduced because of the need to sink 1.5mA for the endstop LED on the Duet.