As long as opium (and by extension heroin and other derivatives of it) are in high demand, someone will supply it. So if you believe that keeping opium and its derivatives illegal is worth the Tailban and their friends to have a very easy way to get a massive amount of profit, well, you’ll have to live with it.
Making opium legal would only increase demand and increase the size of the terrorists’ wallets.