Any war we do not fight WWII style (TOTAL NO-HOLDS-BARRED ABSOLUTE COMMITMENT TILL UNCONDITIONAL SURRENDER) is “unwinnable” which is why all of them since WWII have never really been “won”.
Also, America should never enter a war it will not make a WWII style commitment to.
Had we committed to defeating the Taliban on the level we committed to defeating Germany and Japan our military would have had to take the war massively to the territory of Pakistan as well - which has been nothing less than a safe haven for the Taliban (not to forget they also gave final refuge to Bin Laden. Could any U.S. president have obtained that level of commitment against the Taliban? Very doubtful. So that war was never “winnable” from the start.
One thing that we could under international law is to treat any combatant not wearing a uniform be immediately shot as a spy. That would keep things simple.