IMHO, the main reasons of the whole collapse were:
* US failed to understood the traditions of tribal politics and warfare in Afghanistan, which assumed that defectors from losing side should be allowed to join the victorious and given some (at least token) representation in ruling. Instead, US went for total destruction of the opposing side.
* US absolutely failed in nation-building. Turns out that abstract ideas of "liberty", "human rights", and "opportunity" by themselves means very little, and, if not supported by actions, are not attractive for non-Europeanized populaion (which is the majority of Afghani). And "pumping in money" and "creating business opportunities" just simply did not work in such situations; it benefits only elite, not to mention, that the only business US managed to create here was illegal drug trade.
* US failed to comprehend the Soviet experience, under the purely ideological cliche that "they failed because of Communism, and therefore this experience is irrelevant for us". Near-paranoid fear of American elite toward any socialist or communist ideas really started to jinx US functioning; you could not just cut away a giant chunk of social, political and economical concepts and trying to pretend they never existed.
As a result... Well, pro-Soviet government in Kabul endured for three years after Soviet troops were withdrawn. Pro-American collapsed in mere days.