This could be the cables are mislabeled, this happens once in a while.

If you follow the cable from the controller to the stepper motor and from the end_stop switch to the correct location on the controller.
This is the only way to see it the are correctly labeled.