I hope this message finds you well, present circumstances excluded. I am a licensed attorney with over a decade of commercial driving law experience. It is a pleasure to assist you today.
The short answer is that there is not a federal or state statute or regulation that would prevent them from taking this action. However, they likely violated one of their own safety protocols in taking this action.
I suggest that you do two things:
(1) File a complaint against the officers with their agency and request to know the outcome of that complaint as soon as reasonably possible (that might not sound like much, but they are duty-bound to investigate if you are willing to sign a sworn complaint form - and this will likely result in the discipline of the officer or officers before it is concluded); and
(2) You can send a public records request to the law enforcement entity that made the stop for any and all policies and procedures relative to leaving pedestrians on the road side in an unsafe manner, such as this one. They should have something on file that they can provide. You can actually take this document and file suit against the agency for reckless endangerment by showing that they breached their own policy and left in you peril as a result thereof.
Those are your two best options under the circumstances.
Let me know if you have any other questions or comments.
Best wishes going forward!