Please forgive me if these are stupid questions...

The writers of Avengers: Endgame have stated that the "one" way Dr. Strange foresaw Thanos being defeated was Tony Stark/Iron Man dying and the Infinity Stones being destroyed.

My question is this...

At the end of Endgame, Stark dies because he stole the Infinity Stones off of Thanos' gauntlet and used them to defeat Thanos, resulting in Stark's death from the release of energy from the stones.

But the stones weren't destroyed at all at the end of Endgame. They were taken back to the past by Captain America. So, why weren't the stones destroyed like Dr. Strange foresaw?

And how does taking the stones back into the past prevent anything from happening again?