As noticed in D1239 units can slide a bit when changing the variant without changing the animation, the issue was tracked down a bit by temple:
The issue is that if the animation names are the same (which they are here, both walk), then it doesn't update the animation id right away (in SetAnimationState of UnitAnimation.cpp). E.g. carry_food doesn't have an id for walk but base_hoplite has walk1 and walk2. So then switching from walking & fighting (which uses hoplite) to walking (which uses carry) tries to find the old walk1 or walk2 id which doesn't exist, so it uses the idle animation by default, hence the gliding for a second or two before the animation id's finally updated. However, if there's no id then it takes all possible animations (in GetAnimations of ObjectEntry.cpp) so going from walking (using carry) to attacking (using hoplite) is okay. Women's walk doesn't have an id so there's no problem switching between walking & fighting and walking.
So we probably need some way to update the animation id earlier.
But beside the ID, we need to reload the animation also.