We keep hearing that Biden has ended the US's longest war. Technically that's true, but also technically, the Korean War isn't over. There's never been a peace treaty. And the US has about 28,500 troops still in Korea, some 60 years after the active shooting war is over.
There are 80,000 US troops stationed in Japan.
And 35,000 more in Germany.
What's different about Germany, Japan, and Korea from Vietnam and Afghanistan? First Germany and Japan. Both were soundly defeated in WWII. Germany was divided by the Soviet Union, the US, France, and England. The Soviet Union, which controlled East Germany, was seen as the biggest threat to West Germany.
Japan was also soundly defeated and ruled by the Allied forces, though effectively headed by General Douglas MacArthur. A democratic Constitution for Japan was created under MacArthur's leadership. Japan's two greatest adversaries were neighboring China and the Soviet Union. Again, the US presence served as protection for the severely battered post-WWII Japan.
South Korea was threatened by North Korea supported by the Chinese. The US helped keep the North Koreans and their Chinese allies from taking over South Korea.
In all three cases, the US was seen as a military protection from outside invasion - China in Korea's case, the Soviet Union and China in Japan's case, and the Soviet Union in West Germany's case.
In contrast, both in Vietnam and Afghanistan, the US was supporting a government that was more aligned with foreign powers. Vietnam had recently gotten rid of the French colonial rulers. The US came in backing the Catholic French colonial Vietnamese against the indigenous Buddhist Vietnamese.
In Afghanistan, again, the Kabul government was aligned with the US against Afghan groups - Taliban and local tribal leaders. It's more complicated than that, of course, but basically the Muslim nation was fighting a basically Christian outside force.
In both Vietnam and Afghanistan, there was outside support for the North Vietnamese and the Taliban, but it was to oust was was seen as an occupying force from the West.
So in the cases of Vietnam and Afghanistan, the US military was fighting a war, far away from home, in a country they knew little or nothing about. They didn't speak the language and needed interpreters or locals who spoke English to communicate. They couldn't tell their friends from their enemies. Their opponents were fighting for their homeland and to expel the invaders.
Perhaps this is one of the key lessons we should have learned. We can support countries that see us as allies against their fight against a feared enemy. We oughtn't, otherwise, be outsiders picking a side in a civil war, especially in countries we (the average US citizen and the soldiers) know little or nothing about.
And, of course, we should not assume that what happens us in the future will be exact matches to what happened in the past. We must be careful to choose our models carefully and to weigh various factors.
And the world has to figure out how to protect humans from their own ruthless rulers. It's all very thorny and no one emerges unscathed.