- The Trump deal was conditional on the Taliban meeting requirements they ended up not meeting (supporting other terrorist groups), which would have invalidated that agreement. Additionally that agreement was very high-level with details left open-ended, and it could have been implemented via a safer, phased withdrawal. I say this as someone who recognizes Trump could also have led the US to this same (or far worse) outcome.
- The Biden administration had every authority to change course from Trump. Clearly Biden had no problem doing so with a list of immediate executive orders, and he could have made different choices here. In fact he already did, since he withdrew by August rather than May (a departure from the Trump-Taliban agreement).
- Biden repeatedly claimed that there was no way the Taliban could overwhelm the Afghan army, but that's what happened. This seems like an unplanned outcome (the alternative is that Biden lied to the US public and the world).
- Other allies like Germany were also blindsided by the unilateral choice to withdraw as the US did, which left them scrambling to figure out a safe exit for their people and other collaborators.
- The US could have left a small force of 2500 to help keep the peace - that seems like a small price to keep the Afghanistan government together for another generation.
- The US could have taken stronger action historically against Pakistan, which has provided a safe space for various terrorist groups to rebuild, including both Al Qaeda and the Taliban. Even doing so now, while continuing military support of the Afghan government, could have set up for a safer future withdrawal.
It was not unplanned (a surrender was signed during the Trump Administration, well before the withdrawal was completed), nor has it been avoidable at least since the war of choice (and aggression) in Iraq; whether it was avoidable without that is debatable, but ultimately irrelevant, since the invasion only occurred because the Administration was boxed in politically and couldn't use 9/11 as an excuse for their preconceived war on Iraq without first making a show of going after al-Qaeda where their leadership was known to be.