It's normal for the endstop to show as hit when you unplug it when using S1.
What I suspect is happening is that the endstop is marginal when run from 3.3V. When not triggered, it is pulling the endstop input low enough to light the LED but not low enough to be registered reliably as triggered by the processor. The remedy is to reduce the IR LED series resistor on the endstop board as I describe at https://duet3d.com/wiki/Connecting_endstop_switches#3.3V-compatible_optical_endstop. If the series resistor is an SMD type, you may find it easier to solder another one on top (so in parallel) rather than replace the existing one.