At the end of Avengers Endgame, Captain America returns the infinity stones to their proper timeline. My theory is, when Captain America returned the stones to their respective time, the TVA erased the time branch after Cap left. And the reason they didn’t erase the branch Captain America lives his life out with Peggy, is because he was supposed to grow old and pass the shield on to Sam Wilson. So when Peggy died and his kids grew up he left that time branch and return to 2023 to pass on the mantle to Sam.