The cables you link are supposed to be assembled by crimping rather the soldering. The risk of them falling out is mostly because the housing are only for a single contact.
If you instead get multi-contact housings the width of the headers you are matching, and insert contacts into those in the desired positions, the risk of things falling out will be greatly reduced. You can add a label to indicate correct insertion direction.
Of course, a much better result would be to make either a custom shield with terminations for the signals you need to route elsewhere, or to replace the Arduino itself with a custom ATmega board that handles application-appropriate polarity-keyed wiring harnesses.