Yeah breaking down the time rules here will make your head spin, especially since Nebula literally killed a past version of herself. You could argue that this is possible because present day Nebula is from a different timeline. And a past version of Thanos dies, which would undo the previous films. But I’m pretty sure they were insinuating that Steve always went back in time in the main timeline and he was Peggy’s secret husband all along (I don’t think we ever actually saw what her beau looked like so I’m guessing this is the reason). So yeah... when you pick it all apart, it really doesn’t make sense but I think I’ll let them slide here because the movie works as a big emotional payoff. And I honestly can’t think of any time travel movie where they cover all the bases; there’s usually something in there that doesn’t quite add up.
I think I kinda figured it out. Hear me out, this will be long but hopefully explains the main stuff! The main things confusing people are Cap going back, Gamora and Loki.
The main timeline is what we live through and see the whole way through, at no point do we see an alternate timeline. All the events play out like we have watched for the past 10 or so years, it gets to End game, they go back, and although they are in the past we are still in the main timeline. Any changes made in the past does not affect the future, this is why they can’t go back and kill baby Thanos. What they can do though is bring the stones from the past and bring everyone back.
Now Loki’s bit. When they go back they mess up and Loki gets the tesseract, this now creates a different reality, but this does not affect anything for our timeline. Cap and Stark go back further to get an early version of the tesseract. When Cap goes back at the end of the film and replaces the stones, he goes back to the point him and Tony got the tesseract from in 1970 or whatever. If you start again from this point everything plays out like the films we watched previously. When it gets to 2012 in New York, Loki still loses, he does not get the tesseract. It still needs to get to Endgames point for them to go back and that’s when Loki gets the tesseract. I think people are making the mistake of thinking Loki always got the tesseract or gets the tesseract from the first battle in New York. That’s not the case.
Gamora, this is easy, she dies in infinity war, avengers go back through time, Thanos figures out what they are doing, goes to the future with Gamora. The fact that past Thanos goes to the future does not mean that infinity war didn’t happen and could not have happened, it had to happen for them to get where they are now. Gamoras past self now exists in the future not knowing the guardians of the galaxy and probably just wanders off in the end.
Captain America. He goes back, drops off the stones but instead decides to stay in the past to live a life with Peggy. We are still in the same timeline/reality. Peggy met the original captain, he got muscles, did his bit, got frozen, the future captain probably comes back around this point and explains everything to her and lives with her whilst the other captain is frozen. There will be a point where captain America unfreezes and the future captain is now old and they both exist at the same time but this doesn’t stop the young captain doing everything he already did in the other films he knows no different. This is still the one timeline/reality. This is why old captain America is just there at the end, no machine to get back, he was already there.
We are watching the first go through. This means that when we watched the films originally Captain America was the only one, Peggy married someone else etc. It gets to Endgame, and they do the mission put everything back, the only changes is Cap decided to stay (not affecting events in any way) and Loki got a new reality created for him, we don’t see because we stick with our timeline. Hopefully this makes sense.