The older version of Captain America in Avengers: Endgame is not a plot hole.
In the fourth Avengers movie, the remaining heroes travel back to the time (courtesy of Antman’s quantum realm) to extract the Infinity Stones (destroyed in the present) out of previous Marvel movies so they can undo the disastrous effects of Thanos' snap. While on the course, a new timeline is created by Loki, the brother of Thor after the battle of New York, in 2012 Avengers.
But what has caused the most confusion isn't the mission itself but the final use of time travel at the end. Because removing the Infinity Gems from the time stream can have a cascade of consequences. But to avoid that, Steve Rogers (Chris Evans) heads back and replaces them all (as well as Mjolnir) at the points the Avengers took them. But instead of returning to the present, Rogers travels to the 1940s to live the life he never got with Peggy Carter (Haley Atwell); and so Endgame ends with an older Steve passing the Captain America shield to Sam Wilson aka Falcon before we are shown Steve and Peggy's long overdue fateful dance finally happening.
Captain America Travels Back In Time To Restore the Infinity Stones to their respective places in Avengers: Endgame.SOURCE: Marvel Studios
The finale of Avengers 4 couldn’t have been more perfect. But some are still nitpicking around apparent plot holes. But here’s the thing; there are two perceived issues, both of which misinterprets the time travel methods used in Endgame. So here’s how Captain America's ending really works and doesn't deter the time flow in any way.
Of course, Endgame's time travel is incredibly inconsistent and repeatedly breaks its own rules, often in two different ways at once. But, plainly, time is linear - you can go back into the past and move around. The only way to actively modify things is to remove an Infinity Stone as they define the laws of reality, and the film makes clear, Steve solved all of those issues.
Recommended: Why Doesn't Avengers: Endgame Have A Post-Credits Scene?
Steve Rogers living his life with Peggy deletes his time as Captain America; that this happy ending is an alternative to his time in the ice and subsequent defrost. However, it's talking about the wrong or another Steve Rogers.
The Cap who gets the dance with Peggy is the one from the year 2023 who's fought and defeated Thanos, only now giving himself some conclusion in the past time where he was always frozen. There were two rogers during the 20th Century: the one frozen in the ice and his ten-year-older self who'd go back in time to live with Peggy.
WRONG PLOT HOLE #2: STEVE IMPROVISED PEGGY CARTER & THE MCU'S PAST
Steve may have gone to the past and altered Peggy's life with Cap being frozen in the Ice. SOURCE: Screen Rant
The second flaw in pointing Endgame plot hole is that Steve essentially rewrote Peggy Carter's life, replacing her husband and children immediately and, quite possibly, having an indirect effect to the development of S.H.I.E.L.D. and, by extension, the Avengers themselves. This takes everything just explained about the time loop, then considers that any action in the past will affect the MCU timeline, which isn't what's happening here.
The MCU has been quiet about Peggy Carter's husband after Steve’s freeze. He has only been revealed as someone who fought in World War II and was supposedly rescued by Captain America. The reality now, however, seems to be that the husband was always Steve Rogers, perhaps living as an anonymous to keep his existence a secret.
Also Read: 'Avengers: Endgame' Breaks The Global Box Office Record
Many aspects of Avengers: Endgame's time travel doesn't make total sense, but Captain America's dance with Peggy Carter isn't one of them. His date is a fitting - and logical - end to a film and an era.
As we can assume from the ring on Old Steve’s finger, he and Peggy officially pledged their vows with each other in the past. He may have been coy about revealing her name but this is one of the happy endings, we can be sure of.
The only thing that makes it a bit confusing is the much talked about time travel and Marvel’s ultimate “Infinity Saga” payoff. As Professor Hulk says early on, the present and future can’t be changed, and when one goes back in time, it just becomes the past to the linear flow of time. So Cap and Peggy indeed tied the knot and started a family. Steve kept his head down over the decades and let everything play out while he had his family, then grew into the moment. All the while, another Captain America fought the battles we’ve seen before.
If Bruce’s theory is true, Cap is not the father of those kids he saw in previous movies, but that doesn’t negate their relationship. This is a time travel riddle — and one that’s happened off-screen. Are there more Peggys coexisting in the timeline, too? Did Cap jump back in time before or after he saved the father of her children? Directors Joe and Anthony Russo don’t explain this up through the filmmaking — after Steve jumps, the camera rolls over to find Old Cap, who, if Hulk and Tony Stark are right, has been living undercover this entire time, a happily married man.
For as many questions as the film raises, the emotional culmination of it all seems definitive. Steve and Peggy get their dance.