The world changed. The British and French couldn't control those colonies anymore. Guerrilla insurgencies are very hard to beat.
In order to win you either have to convince the people to support you, which is almost impossible as an outsider. Or you make them fear you worse than the insurgency. That is impossible under international law.
But if the US really wanted Afghanistan to bend to it's will and didn't care about international law? Just carpet bomb villages that don't support you against the Taliban. Relocate tribes to reservations and resettle your supporters.
Why didn't Japan and Germany have insurgencies? They were afraid of what we'd do.