Like in every conflict there are many factors that complicate matters. I've already mentioned the atmosphere of corruption, which made billions of western help disappear into thin air. Internal division (between Pashtoe and Tadzjik for instance), the destructive influence of countries like Pakistan, Russia and Iran, the stubborn reluctance of the average Afghan to accept foreign (especially non-moslim) presence and advice, Western naivity and indecision, the greed of (not only western!) companies to share in the booty are some ot the other factors. Compared to Afghanistan to make an end to the endless conflict in Northern Ireland was a breeze.
I've heard the argument about the West stealing Afghan resources before and from many people, mostly Afghans. There is some truth in it, but it originates mostly from frustration, fake news from the usual sources and reluctance to admit that if you put two Afghans from different backgrounds together you've got the making of a civil war. They are great and proud people, but not the easiest to deal with.
Every fair minded Afghan will confirm the above. It is a huge tragedy and especially the Afghan women and children deserve better.