I can see two possible reasons for this.
1. Your CNC controller (you didn't say which one you have) has a bug that causes this unexpected behavior. Unlikely yet possible.
2. Your limit switch circuitry somehow disables the rest of the limit signals when one of the limit switches is active. Watch your breakout board inputs while running the test to make sure the signals are where they should be.
By the way, what is the purpose of disabling each axis separately? Normally, hitting a hardware limit switch is an emergency situation that should stop the machine completely until the problem is rectified.