Unless we actually see this event portrayed in a future movie, or the directors decide to offer an official explanation, we can't know for sure.
But recall the idea is that Captain America returns at the exact time the stones are removed. Professor Hulk describes it as meaning that, chronologically, the stone never left. So when he arrives, the stone has never left Vormir. So the condition for Red Skull's release may have never actually been achieved: the stone just moved around a bit, nothing more.
Some interpret Professor Hulk's explanation (who, by the way, you shouldn't entirely trust to know what he's talking about; it's Tony that figured out how to time travel correctly, not Hulk/Banner) as meaning that if correctly placed then there is no alternative timeline created, despite the evident and obvious disruptions: reality collapses them back in to each other somehow, or the apparent "alternate timeline" only exists to serve the purposes of the time heist and then ceases to continue on independently after the stones are replaced.
Alternatively, in the comics there's a certain sense in which the Infinity Stones have their own will and the capacity to enact it, if only subtly. If much the same holds in the MCU—and the tesseract specifically taking Red Skull to serve as gatekeeper to the Soul Stone, as well as Red Skull attributing a "certain wisdom" to the soul stone in particular, strongly suggests it does, and that the stones work together—, then the stone(s) may have specifically conditioned Red Skull's release not on a generic "someone gets the stone", but rather on "a particular someone with a particular goal they are likely to achieve gets the stone" condition. Or, less opaquely, it was specifically conditioned on Thanos acquiring the stone for the express purpose of killing off half the universe. Or, perhaps more easily, the stone on its return simply doesn't release the Red Skull because it knows his purpose has not truly been fulfilled.
Moreover, the stone could simply return itself to wherever it is it comes from at that time. How did you suppose it got there in the first place?