Afghanistan has always been problematic, neither the British nor the Russians could hold it for long.
The Western intervention was flawed from the beginning. Bush refused Russian help and deliberately antagonised Iran.
Despite that there was a brief period at the beginning when the Afghanis could have been won over but instead of focusing on jobs and infrastructure Bush decided to illegally invade Iraq.
The Taliban were not going anywhere, the Afghanis knew that.
And the Gulf money that supported Al Qaida and the Taliban is still there.