Basically, yes. I saw that.
And that is why, I would make a bidirectional hall effect current sensor the heart of a new system.
Brushes create noise and when the system starts up, there is a large current draw. These have to be ignored.
So, a simple, Current exceeds X amps for Y time may work. For greater sensitivity, you might add. ignore I(t) for Z mS when motor is started from rest. I(t) is current as a function of time.
Some time in the 80's I was working on a gantry crane for a model railroad and I needed some method to prevent damage to the motor/components if the gantry were to hit a hard limit. I selected components such that a cap charged when the current was exceeded and then it turned on an SCR which dropped the regulated voltage to zero. Reset required the power to be recycled.
The direction tells you if it's a forward or retract limit.
So, your code may say, if I'm at a retract limit, I can only extend and if I'm at a forward limit, I can only retract or you can ignore it and the motor would try to move a small amount and stop.
The other logic is safety, like don;t move the steps if the trailer is moving (Ignition on).
And for convenience, extend the step when the door is opened (only once) after the Ignition key is turned off.
And the other is retract the steps if someone forgets to. Use the On when engine running type of signal like the ECM power.
And deal with manual accordingly. You could allow jog FWD and jog REV.