Significantly, the Taliban does not consider its actions "terrorism" as it was the government in Afghanistan until it was deposed by the Bush led invasion. It is merely fighting to re-gain its position. The war in that country has not been won despite years of Western intrusionism because the invaders still have not gotten the support of the population's majority who have rejected the puppet rulers imposed upon them. Same reason why the USA lost its imperialist war in Vietnam as the majority refused to accept the puppet government imposed by the West. Therefore, the Taliban's action cannot be considered terrorism. By the same token, the West's invasion of that country is clearly definable as imperialism.
I know a thing or two about the stan.
I think you raise a fair point that the Taliban considered itself the government so by extension much of their actions can be reasonably seen as those of war and not terrorism (though they did not honour any of the conventions of war like the various states did) but you are stretching it a fair bit when you state that "it was the government" which is technically incorrect as roughly a third of the country remained under the United Front and aliban control and was limited to the Pashtun tribal areas in the south.
Also, only two, maybe three countries tops recognized the Taliban as the legitimate government of Afghanistan prior to Western intervention in what had become a rouge state sponsoring and exporting Islamic religious extremism and terrorism. The UF was assisted by the "Bush led invasion" in defeating the Taliban and seizing control of the whole country.
As for your assertion that the West (there were 57 countries including China and Russia) lost through a failure to win hearts and minds, is an oversimplification of a much more complex dynamic than your statement gives credit to. The coalition achieved it's primary stated goal of removing the Taliban from power but failed in the nation building attempt.
That failure did teach countries like Canada just how batshyte insane and unreasonable Islam is and no ones wants boots on the ground in any Muslim land but I'll tell you this, give ISIS or the Taliban or Al Qaida or Al Shabab or Boko Haram the power of a state and I guarantee we're going in and that is not imperialism, that is self preservation.
As for your assertion about clearly defined imperialism I suppose it is correct in the context of a global coalition that vocally didn't want to be there and was looking for an exit strategy can be.
Bottom line. Afghanistan is one of the worst ****holes on this planet. If there is anything approaching hell it has to be close to being born a female in Afghanistan. I would rather be dipped headfirst in an outhouse pit then spend an hour in a Kandahar market. There is absolutely nothing redeeming about the country and they will be killing themselves in the name of Allah for centuries to come while the rest of the world moves forward.