To be fair, everyone from Alexander the Great to the Soviets have tried, and failed, to pacify and stabilize Afghanistan. And yes, I believe the job is impossible as long as our enemies can flee across the border to the territory of a nominal “ally” and we can’t really go after them there.
And no, it cannot possibly work in the long term *regardless what we do*, unless and until something can be put in place to fill the HUGE economic niche currently filled by the opium trade.