Tactical retreats can serve a great many purposes …
Firstly, they can, as you posit in your question, withdraw a unit from engagement and otherwise save it from destruction and/or to fight another day.
Secondly, and tangentially, they could also be undertaken to withdraw a weary or otherwise tired unit, thereby sustaining its combat effectiveness.
Third, a unit could withdraw because they felt themselves to be at a disadvantage, like the terrain, or because they lacked forces/numbers, or weapons, or reinforcements.
Fourth, a unit could also withdraw to gain an advantage, like a movement to more advantageous grounds and/or a better position or situation.
Fifth, and most interestingly, a withdrawal could be a well designed trap!