INFINITY WAR: basically, if Strange tells Tony they're in the right timeline before everything that needs to happen happens, it won't happen. Strange holding up the one finger is a signal to Tony that everything that needs to happen for them to win has happened, they are in the one timeline. If Strange had told Tony before this, those things wouldn't have happened. He saw 14 million futures. He knows exactly how this needs to play out.
As for the time travel in ENDGAME, Hulk and the Ancient One make clear that you can't change the past. By changing things, you're just creating another timeline. Your past is your past, you can't change it. So even if Cap were to change things in his new life with Peggy, it wouldn't affect the main MCU timeline. The Gamora from 2014 running around in 2023 doesn't affect the Gamora we followed in GOTG 1-2 and infinity War. She still lived and died. The new Gamora is one from a different timeline. So if Cap were to change anything, it wouldn't affect the main MCU timeline.
Easiest way to explain it is this:
Main timeline: The one the MCU follows and is in now and will continue to follow.
Timeline 2: Everything the same up until the Battle of New York. Loki escapes with the Tesseract, Captain America and Hulk steal the Mind and Time stones. Cap later returns these stones to the moment they were taken, restoring this timeline almost to normal (Loki is still on the loose with the Tesseract).
Timeline 3: Everything the same up until "Thor: The Dark World". Rocket removes the Reality stone from Jane. Cap later returns the stone at the moment it was taken. This alternate timeline is erased and restored to the main timeline? WE don't know how it works.
Timeline 4: Everything same up until the 1970's. Tony steals the Tesseract from SHIELD. Cap later returns the Tesseract. This alternate timeline is erased and restored to the main timeline? WE don't know how it works.
Timeline 5: Everything same up until GOTG. Rhodey and Nebula steal the Power stone while Nat and Clint retrieve the Soul stone. The Thanos, Nebula, Gamora and Thanos's army of this timeline travel to Main Timeline, where Thanos, Nebula and Thanos's army are killed. Cap later returns the stones but this timeline goes forward without Thanos, Nebula and Gamora.
Timeline 6: Captain America goes back to the 40's and lives a long and happy life with Peggy. Cap returns to the main timeline to say farewell to Bucky and Sam after Peggy presumably dies.
As is made clear in the film, you cannot change the past. The past remains the same no matter what. The time travel rules from other movies don't apply to the MCU. Instead, you create a different timeline. The timeline you originated from still exists. The changes the Avengers make in the past have no effect on the future they came from.
Radically DIFFERENT approach from the Fox X-Men Main Universe, where the timeline is revised twice and we got three timelines for the same universe:
Timeline 1: X-Men Origins: Wolverine; X-Men; X2; X-Men: The Last Stand; Logan.
Timeline 2: X-Men: First Class; revised movies; The Wolverine (2008); Days of Future Past 2023.
Timeline 3: X-Men: First Class; Days of Future Past 1973; X-Men: Apocalypse; Dark Phoenix; The New Mutants; DOFP New 2023.
The X-Men main universe (X-Men + Wolverine) has been altered via time travel twice, not just one ("Days of Future Past").
This means that the timeline depicted in "First Class" (1962), "The Wolverine" (2008) and the post-apocalyptic future of "Days of Future Past" (2023) was already a massive divergence from the original, untampered version of history (the X-Men trilogy; X-Men Origins & Logan).
According to my scenario:
Sebastian Shaw (Kevin Bacon) was a time traveler. He was born in the original timeline (X-Men Origins: Wolverine; X-Men; X2; The Last Stand; Logan).
At a certain point, when he was 50 or so - several years after the events of "Logan" (2029) - he traveled back to 1912 A.C. and impacted the timeline over the years in various ways... until creating the Hellfire Club.
He also changed Magneto's life in 1944.
The events of "First Class" were deeply caused by him, as well as having many birthdays shifting in time and characters being born later or before (Angel, Jean Grey).
I guess he influenced many powerful people over the decades, impacting their lives - Warren Worthington II (Angel's father) was among them.
FC Moira was the grandmother of LS Moira, as simple as that.
Emma Frost was already existing. Maybe, in the original timeline, Emma Silverfox was a clone of her who was adopted by Kayla's family (that's it).
So in the end, we got the second timeline:
1962- First Class
1963- JFK dies. Magneto is arrested.
1973- Mystique kills Bolivar Trask.
1983- Alternate version of "X-Men Origins". No Alkali-Transigen, no "Logan" future.
2000- Alternate version of "X-Men" and "X2".
2001- Alternate version of "The Last Stand".
2008- The Wolverine
2023- Post-apocalyptic future of "Days of Future Past".