The Lannister brothers on Game of Thrones were friends until the very end, which makes the repaid favor in Sunday's episode all the more bittersweet. Tyrion freed Jaime on Game of Thrones, repaying him for doing the same in Season 4. Unfortunately, he almost certainly doomed both of them by doing so.
For some reason, Tyrion really, really didn't want his sister to die. So, when he learned that Daenerys' troops had captured Jaime in his attempt to sneak into King's Landing to be with Cersei — Tyrion freed him. It was a callback to Season 4, when Jaime freed Tyrion... and he then proceeded to murder Tywin on the toilet.
Back then, Tyrion was being wrongfully imprisoned for Joffrey Baratheon's murder. Tywin Lannister was planning to execute him no matter what, and so Jaime set him up with safe passage out of the city. Even in the Season 8 callback, Tyrion told Jaime that he never thought he'd be able to repay the favor. And as it turned out by the end of the episode, it might not have been a favor at all, really.
That being said, this isn't the only moment from the series that the scene mirrored. Tyrion begging his brother to take his sister and leave for Pentos is very reminiscent of what he begged Shae to do — also in Season 4. Unfortunately, Shae was caught by Tywin before she was able to do so, just like Jaime and Cersei were crushed by rubble before they were able to get out. Devastating. As clever and conniving and self-sufficient as he can be, Tyrion really wants what's best for the people he loves. It's positively Shakespearean how that ends up being his tragic flaw again, and again, and again.
Even if Jaime and/or Cersei managed to live through King's Landing literally falling on top of them, this is probably the last time that Jaime and Tyrion will see one another. It's sweet that Game of Thrones gave them this last goodbye. Before all of this drama started, these two brothers were genuinely very good friends. Cersei got a lot of things that she wanted, over the years, but she never managed to drive the two of them apart.
What will Tyrion do, now that Jaime and Cersei are gone, and Daenerys torched King's Landing to the ground? She's certainly ruined all of her local allegiances now, and Tyrion is fast running out of allies. Would it even be worth it if Bronn showed up right now? What was the point of his deal with Cersei and/or the brothers Lannister, now that all of this has gone down?
House Lannister has miraculously survived this far on Game of Thrones largely because they tend to put their own family first — so, as sad as it is, it's fitting that family devotion was a large part of their downfall. It's sweet that Tyrion freed Jaime, but he should have left him safely locked up during that horrendous battle. Honestly, while Tyrion and Jaime may not like Winterfell, but they should have stayed there.