Agents of S.H.I.E.L.D. and the resurrection of Phil Coulson was never a branched timeline from the MCU movies. It was always Sacred Timeline despite some naysayers.
The time travel plots in seasons 5 and 7 follow the same rules established by Loki, What If, and Avengers Endgame. In Loki stealing the Tesseract in Avengers Endgame leading to the Loki tv series branch timeline is basically on the same level as the destroyed earth timeline in season 5, which they prevented from happening when returning to the sacred timeline, thus still staying in the sacred timeline all through season 6, which can be easily explained that they survived the blip like Daredevil and Kingpin did, and then created more branched timelines in season 7 but returned to the sacred timeline through the quantum realm.
Also it's explained to us through the TVA instructional video that one decision different from the decision that was supposed to happen could lead to branches. If the team gave the super soldier serum to Coulson in order to save him in season 5, that would lead to the branch where the earth was destroyed. Daisy taking the serum and launching Talbot into space was what was supposed to happen on the sacred timeline, thus keeping them all tied to the sacred timeline.
Also, if the earth was destroyed, how would the events of Avengers Endgame and all the rest of the Phases 4 and 5 events happen? They wouldn't happen, so Agents of S.H.I.E.L.D. basically saved the earth so the future events we saw happened.
This how you can Very Extremely Easily fit Agents of S.H.I.E.L.D. and Agent Carter into the sacred timeline.