The changes on lines 346-363 pull the direction bit checking away from the endstop checking. This must be done for corexy, since the step profiles (motor movements) computed in planner.cpp are translated to the A axis and B axis, while the endstops are being checked for the true X-axis and Y-axis. Notation is crossed at this point in the code, so X_AXIS and Y_AXIS actually refer to A_AXIS and B_AXIS for corexy.