I used my cavalry to aggressively defeat the enemy horsemen but the attack failed on both flanks and my equites routed so I had to use my triarii to hold off the Epeirote horsemen before I could be hammer & anvil'd.

Against a barbarian faction it's plausible for the first line to route the enemy, but against a phalanx you have a few minutes to outflank it with reserves before any cohorts in front of it route. It's also true that you won't have to put principes or triarii into the fight if your own cavalry can flank the phalanx.

To save a formation on the march, you have to make sure it's not too spaced out and uneven but has symmetry, select all your units and hold down alt than right click where you want the formation to go. To see if it's going in the right direction hold down space and it'll highlight where units are going. If your army is uneven the game will make them form into a straight line.