RAW: Yes, and that's fine
The relevant excerpt from the Player's Handbook (p. 189):
If you're surprised, you can't move or take an action on your first turn of the combat, and you can't take a reaction until that turn ends.
Which would mean a creature which for whatever reason was moving before Initiative was rolled, does not move during it's first turn (the turn it was surprised). This might seem odd at first, however it is an artifact of what initiative order, and surprise, is trying to emulate.
The typical scenario is one party (the aggressors) initiates on another party which did not know about them. The aggressors have the opportunity to choose exactly when they attack, and so have one round (a span of 6 seconds) to act before "normal" combat resumes.
Lets use the moving horse and cart as an example. The aggressors decide to attack as the cart passes them as so Initiative starts with the cart by the party, surprised and "stationary". The alternatives to using Initiative/Surprise in this fashion leave the success of such ambushes up to the Initiative roll. For the dragon example the casting of gate should happen on the first roll of initiative. Otherwise for much the same reason.
The key is that residual movement of the first turn of initiative is abstracted away, such that the creatures are during that round where the aggressors wanted them for their planned attack. As a more general note Initiative, Turns and Rounds should not be considered too closely. Everything that happens during a round is narratively happening semi-simultaneously during the span of 6 seconds. This is a way for a game to handle that.
If you would like to have a cart continue moving even though they (horses, drivers, the mimic under the seat etc.) are surprised, that is doable, just make sure it does not break the ambush that is planned. The aggressor have the agency to strike precisely when they wish to, and so should be able to start initiative as is most convenient to them. There is so much DM fiat in when to start initiative and who are surprised, that minor modifications like this should not be an issue.