To name just 3. Truth is, most insurgencies fail. The problem is, how do you define "victory" and "defeat". Most wars don't end with the Red Army marching into Berlin or an atomic bomb being dropped on Nagasaki. Most wars end inconclusively when one side or the other reaches a point of exhaustion but after the other side has expended so much of their resources that they just can't put the other guys away. So, they cut a deal. Maybe it holds, usually it doesn't.
The problem with Afghanistan is that they have a martial history stretching back to Alexander the Great - and probably for a lot longer before that. The other problem is, it's one of the most worthless places on earth. Lousy climate, no really valuable mineral resources. All they've ever contributed to the world is a lot of tribal violence. The only real way I can see to fix things is to wipe out the current population and resettle the land with Swiss immigrants but I don't see that as likely.
I know this is Wikipedia, so take with many grains of salt. Afghanistan apparently has mineral resources.
“This diverse geological foundation has resulted in a significant mineral heritage with over 1,400 mineral occurrences recorded to date, including gold, copper, lithium, uranium, iron ore, cobalt, natural gas and oil. Afghanistan’s resources could make it one of the richest mining regions in the world.”