This is where skirmishers come in handy. Usually, you pull them backward behind your main infantry line. Instead, withdraw your infantry line at a run, and charge the skirmishers through your infantry line and into the enemy. It'll slow both your retreating infantry and your charging skirmies down, but once they hit the enemy, your main line will be able to hotfoot it away. If your skirmies are fleetfooted enough, they can fall back and outpace the enemy as well. If they can't, accept the casualties and reconstitute what is hopefully a cheap skirmisher unit.

I've actually pulled this tactic with heavier troops using the Romani. Enemy heavy cav usually charge the hastati, perhaps sensing their weakness in comparison to other divisions. I also fight in typical Polybian/Camillan formation with the Romani, though, so the hastati are always the first struck anyway. My trick is to have the hastati fall back, not through the Principes, but through the Triari, who can hold their own much more effectively against cav and even units like Gaesetae.

These withdrawals are easy if you are playing an all-cav army like the steppe peoples. Their tactical withdrawals are the stuff of legend in Persia, Rome, and China alike. My tactic is to blitz an enemy army, keeping my distance while peppering them with arrows. When my quivers are empty, I retreat. Wash, rinse, repeat. You can destroy an army 4 or 5 times your size and quality in a year without losing a single man this way. I tried this strategy against the Bactrians with the Sauromatae, as soon as the game began. I didn't lose a single battle, and in fact I completely annihilated their entire faction within six years of game time. The steppe peoples, being masters of the feigned retreat and the tactical withdrawal, are your best bet if you like playing with them.