Inductive proximity sensor false readings

I don't know, but it probably does. In any case, INPUT_PULLUP is merely a convenience. You can just use a pull-up resistor.

Which is why the diode method prevents such damage. :sunglasses:

Fully protected circuit:

Same circuit applies to Pi or ESP with 3.3 V