You can never defeat a guerrilla movement unless you destroy its bases. IOW, the war won’t be won in Afghanistan; it has to be won in Pakistan.
Otherwise, the Taliban will keep sending in new men forever.
They have the old home field advantage. To defeat them, you would have to nuke the Pakis so bad that it would take twenty years to get it back together. And before you leave, you would have to kill all the Afghan males from about 10 and up so it would take at least half a generation until they start breeding again.
Pakistan must be de-fanged and dismembered. The world, and Afghanistan, will be better off.