How would you like a foreign power invading and running your country? You better believe a large part of the Taliban are fighting not out of religious conviction but essentially (Pashtun) nationalism.
Only thing is that when they left, we made sure the Nazi's didn't come back.
Right now they were training Afghans to have their own military, but it's all so corrupt that it is just an impossible task. Those who can will flee the country instead of fighting for it.
Initially, Taliban offered surrender. US denied their terms. So they kept on fighting and rebuilding.
They took over the country in less than a month. They never left. They were always there.