You figure the way the Jihadis want it, they need some place in the world constantly at war at any given time so that they can constantly rotate their fighters through for combat experience. Their problem with being that relatively mobile and light force overall, if a technologically advanced enemy really sets up permanent camp to fight them and means it, they eventually take losses as unsustainable levels.
Think of it as Islamic tactical tourism. All the jihadi tough guys worldwide want their place to go fight, but don't want it to be a guaranteed suicide run. If it is IS, then so be it. in the 1980s it was Lebanon, 1990s Chechnya, 2000s Afghanistan and as the US pullout began in Iraq with the reduced chances of having to fight the full strength of a conventional military, the Jihadis moved into the power vacuum.
The issue with Afghanistan is that it is a heck of a place to fight a war, just still a shithole in the best of times with almost nothing worth fighting over. I don't think their opium fields are really all that big of a deal when compared to the GNP of just about anywhere else.