My approach would be:
- Designate one soldier of the formation "the leader"
- When the formation moves, calculate a path only for "the leader"
- When "the leader" moves, have all other soldiers in the formation maintain their relative position to "the leader". This should not require route finding, only blindly moving into the relative direction.
- Should that be impossible, for example because an obstacle in the way requires to break formation, then the individual soldier should calculate an individual path to its designated position within the formation. In order to regain unit cohesion before arriving at the destination, those separated soldiers should move faster than usual. Or alternatively the leader should notice when they lose a soldier and then slow down until the lost soldier has caught up.