This is a very old bug. When you make a move command on a mobile factory or carrier which was building at that time, the building process stops.
I've read somewhere that a solution has been found in a mod. Sadly I can't find that mod anymore. What they did was attaching a factory to the unit. This way you could select the factory to build, even when the unit is moving.
It would mean double icons, but if this works it's worth it in my opinion. Would it be an idea to add this to the game?
Any idea which mod I am talking about?