Have a ceasefire. Get everyone out. Then when they start blowing people up again, it won’t be Americans. Let the countries over there deal with it.
Let the Russians and Chinese fight over it for all I care.
Withdrawal from Afghanistan will be dangerous. The last group out is at considerable risk to be slaughtered. The terms of a "cease-fire" agreement will mean very little.
The Russians left without notice in less than 24 hours. What they could not carry with them, was destroyed or abandoned. We will need to do something very similar.
And we should.
I like your idea.