Apparently the administration wanted the troops out before the 20 year anniversary of 911. I guess they figured it would take a few months for this thing to collapse and in the meantime they could take a victory lap. I think they just miscalculated.
While the Taliban are primitive mostly, they do have intelligent people in the ranks that understand what was happening.
They knew they would be able to just walk on in to Kabul and retake everything along the way.
Our government knew it too, but they don't care because they will just blame someone else for it.
Look at the history of the area over the last 20-30 years.
This always happens when we leave.
The USA has never stabilized a region.