My mechanical room has no drywall, and I will not be adding any (that is kind of the point). The receptacle used to be on the other side of the room, mounted to one of the bare studs on that side of the room, and the cord was secured via staples along the stud and up along a joist. I moved the receptacle to the other side of the room (rerouting the cord as well). I secured the receptacle to the outside of the wood-paneled wall (as you can see in the picture) and secured the cord the same way as before: up and along the joist, with staples. The staple closest to the junction box is actually closer now than when the cord was routed the other way.
So, it's possible the people who originally put the receptacle in did it wrong, but I can confidently say the cable is not any MORE vulnerable now than it used to be. Keep in mind this room is not a shop, it is my mechanical room/office, and I am not moving equipment or workpieces in or out. I did move my desk in, but that involved picking it up 3" off the ground, and I placed the receptacle to allow clearance for this if I ever decide to move the desk back out and for some reason accidentally graze the wall as I do so.
If code requires that cords always be hidden behind drywall or 100% protected from any possible force, then how are there ever any unfinished basements or rooms in houses?