The lightweight, high-pressure gases travel awfully fast, and probably do begin to reach the bolt carrier before the bullet leaves the muzzle. But it takes a tiny additional amount of time for the gas tube and "air spaces" within the carrier to fully pressurize. And then the carrier is too heavy to accelerate quickly, so the bullet is long gone before the bolt unlocks.
Overall barrel length has some effect on the timing of the mechanism, but the distance from the breech to the gas port is probably much more important. For example, the bullet would be travelling so fast after 20 inches that it would cover an additional 4 inches too quickly to make much difference timewise. But going from a standard gas tube to a carbine-type gas tube pushes your gas port location significantly higher up the pressure curve. The shorter gas travel path that the shorter tube represents does not help things either, but it's the location of the gas port on the barrel that would really make a difference if the same size port was used. The use of a smaller port with the carbine-length gas tube helps compensate for this.
Bullet weight and powder type also affect the pressure curve, but usually there is enough leeway to allow a variety of loads to be used without problems.