The Taliban were largely a disaster for Afghanistan, but it might be arguable that their removal was worse.
As for the present military impasse, I seem to remember pointing out Afghanistan's record against foreign invaders some years ago, on a very similar thread about the then proposed invasion.