Rarely do I ever want units to run into defenses by their own initiative.
Units can be told to hold position, but this brings about other problems.
The default unit behavior and pathing should steer clear of defenses unless expressly ordered to move, attack, or attack move into their radius.
For example, if I have raiders and skirmishers on the edge of a defensive line, I want them to evade, engage, and kite, but I do not want them to chase enemy units into the range of a stinger. This would only apply to defenses that have been scouted, so you can still end up walking into a trap.