Captain America didn’t break time when he put the Infinity Stones back (and had his happily ever after), because the Infinity Stones made sure he didn’t. That’s what The Ancient One explains: the Infinity Stones are there to stop timelines getting split, and to stop the timeline going wonky.
If you think about it, this makes perfect sense. Of course something called the “Reality Stone” - which the MCU depicts as fluid and changing; a pretty on-the-nose metaphor - is capable of adjusting reality so that the timeline doesn’t get broken.
It explains away all the other issues as well. Why didn’t Thanos or Nebula get deleted from history after their 2014 selves came to 2023? Because the Infinity Stones made sure they didn’t - the Reality Stone changed reality so that they never left, the Mind Stone erased any problematic memories, whatever. Why did no one recognise that Captain America was living in the Fifties? Because that’s the version of reality/history that the Infinity Stones facilitated. Because the Mind Stone made it so people didn’t notice the resemblance, like a perception filter from Doctor Who, or whatever. We know that at least one of the Infinity Stones (the Mind Stone) is intelligent and willful, and the Infinity Stones do have a soul: maybe they were “grateful” to Steve, and let him have his happily ever after; or maybe Steve in the past was such a minor tweak to history (compared with the pretty major tweak that a missing Thanos would cause) that the Infinity Stones just let it slide.
Either way, Endgame explicitly spelled out the answer to all of these time travel questions. The timeline is fine, because the Infinity Stones made it so.