My passenger side running board started to act up today. It would start to retract, get halfway and then redeploy. The rig is sparkling clean, so I don't think it's mud/debris as suggested above. I gave each of the hinge joints and squirt of PTFE and cycled it several more times. It kept hanging up, so I gave the last cycle a slight assist - an it fully retracted. I then opened and closed the doors a handful of times and it was working fine. Not certain if the lubricant helped, just helping it past the reverse point, or both? It's something I'll keep and eye on.
I'm sure the motor stall points are set pretty sensitive in order to prevent a hard stop damage event as the OP described. Further, they are likely factory preset (internally) by the company who makes the motors and not adjustable.
I also found this info on another site. This is where I was going to start looking next if the problem continues.
"I finally found the problem! Corrosion had collected in the wire connector that plugs into the electric motor assembly down underneath the truck.
I had to pull the motor assembly to get to the wire connector, just 4 screws, and remove the plastic shield that protects the motor assembly. I sprayed some cleaner in the connector, and probably should have put some dielectric grease in also, but I used an electrical lubricant spray instead. Reassembled and it works like new."
And here's a YT video showing the use of a spray lube to help overcome any stiction that the motor is sensing due to hinges binding.