Not really, I thought this initially too but it does make sense if you think about it.
Events that changed the past affect those branching timelines only and weren't meant to be, otherwise we would have seen Tony, Cap and Antman in the first Avengers movie waaaay back in 2012. So the rules abide that each time you time travel and change history, you do so in a branching timeline so the main one doesn't get affected.
But Cap going back with Peggy was ALWAYS predestined to happen. In the main timeline, while Cap is frozen back in the 40's, another Cap arrives back, meets Peggy, explains everything and arranges it so Peggy never tells anybody that there are 2 Caps (one frozen, the one from the future) existing at the same time. She kept the secret after her death.
Fucking dumb, I know, what with Cap making out with his niece not knowing about it. OldCap also allows all the shit in the MCU to happen to preserve the timeline, it's a classical stable timeloop.
It works, it's fucking dumb but it works.