How is the definition position_endstop applied?

You might also refer to Understanding X and Y Axes Limits and Homing for some explanation.