And having troops there does not stop it. It facilitates it.
Corrupt politicians either bully, or work with, certain individuals within the military to facility manufacture & distribution of these narcotics, using the military's logistical supply lines.
Withdrawing the military breaks the supply chain of drugs from Afghanistan to here, at least by *that* route; and cuts off the $$$ to the corrupt US citizens involved.