Germany and Japan also faced extensive campaigns of cultural reprogramming. Campaigns that already had the foundations of success because both countries were urbanized and covered in mass media. In Afghanistan this was fundamentally impossible because much of the country follows ancient, tribal ways of life that the occupying forces never fully understood or appreciated. This isn’t to say it was easy to rebuild and pacify Germany and Japan—Japan in particular required a very sensitive balance that was probably Douglas MacArthur’s crowning achievement—but urbanized populations that have already been brainwashed by mass media to follow one ideology can easily be reprogrammed by the same mass media to follow a different ideology.
It probably also helped that both countries were so thoroughly devastated that their own “might makes right” ideologies had been clearly discredited by events. You can’t really claim to have racial or spiritual supremacy over your enemies when your enemies have reduced your cities to rubble, driven your people before their armies in vast refugee columns, and occupied your cities with soldiers. Obviously if you take this too far you run the risk of revanchism, so there’s another balance to be struck between domination and mercy.
Another big difference is that both Germany and Japan were accustomed to authoritarianism. Germans and Japanese were very governable peoples, and still are to some extent. The people of rural Afghanistan were ungovernable to begin with, more ungovernable than the people of any developed country. For example, I’m going to guess that your way of life does not involve grabbing your rifle and joining in this year’s season of warfare without any consistent ideological commitment to which side you want to fight for. But this is how many tribal Afghans have lived for centuries. There’s a core of devoted fanatics within the Taliban, but most of the actual fighters literally showed up and treated the war like a pickup basketball game. That’s why we seemed to win so quickly and easily in the beginning—nobody wants to be on the losing side. But as time went on and American commitment diminished, the dynamic shifted before ultimately and dramatically reversing.