Had my first TPK

I'm the DM of my group and we have had our first TPK of my DMing career. The players are pissed (we'll get into that) but also very understanding. I am frustrated and a little worried I didn't handle it as well as I should have. Also, we play online with DNDbeyond and discord.

The session started with the players returning to a nearby town and re-stocking their supplies (we keep track of rations and such). From there, they resume their task of searching for an important figurehead in a prevalent cult (they only know that he knows things, but not that he is a figurehead). All of the players go to the local tavern and begin to ask around. Suddenly the door opens and the guy they are looking for is standing right before them. He notices them and immediately bolts. I ask the party what they want to do. 4 players begin to chase. The 5th says he wants to remain at the bar. The 4 players do all sorts of checks and come up with different ways to track him using all the tools at their disposal in crazy ways. Before they get too far, I ask the player at the bar once more if he would like to partake. He refuses. They eventually get figure out a way to locate the guy and cast message to quickly inform the player at the bar. He responds with drinking beer noises. This happens 4 more times. Eventually the players find the guy through a combination of talk with plants and high rolls. And they begin to fight on the outskirts of town. This happens about an hour after the chase started. The fight begins and then the bar player messages me and asks if he can just show up and knock out the bad guy with a beer mug. This legitimately pissed me off. This player constantly cancels, doesn't pay attention, or actively hurts the party through horrible decision making and lack of communication (this has also led to the death of another characters player on 1 occasion). And then he doesn't participate in any of the roleplay or the chase and asks to just show up at a fight and one tap the boss. So I said no. Anyway, the fight was brutal and despite it coming down to a 2v2, the players ended up all dying except the one at the bar.

The group of 4 players said it's not my fault and blamed the 5th guy (especially after finding out the 5th guy wanted to teleport in and one tap the bad guy). But they were all super sad to lose the characters they had been using for the past 3 months (we play weekly) just because the same problem guy didn't want to participate. I'm also bummed that I wrote very elaborate material for all of their back stories and now much of that will be wasted. I asked if they wanted to retcon it, and one of the players said yes, the rest said no. Overall I feel like it needs to stay because actions have consequences, but it also feels like such a bummer to lose all the progress like this. Should I have done this differently? Do you think I should retcon it?