Why all units speed increase when attacking a building?

after they use siege attack unit get like 20% bonus speed for 1 sec
i dont know if this is a bug, or has a purpose

I think this happens when units return to formation. Once they start walking in formation they again have the usual speed. When they are disassembled but commanded to walk, they will quickly run to their ranks in a formation.