I don't think this will happen so often but it's a bug anyway.
I got a new hero with 4 allies in the same town one of my existing heroes leveld up from an attack from my opponent. The level up included both command and moves upgrade on my hero. This resulted in 162 moves on my hero that took part of the battle.