Vietnam beat China in border clash is a myth. China intention is to never stay in Vietnam long. Plus due to facing Soviet at north border as priority. Those send to Vietnam for war were all second rated soldiers. PLA when invading Vietnam even reached Vietnam cities of Lang Song, how did we loses the war? We treat Vietnam same as India, short war and withdrawal once motive achieve.
Regarding US and coalition defeat in Afghanistan. How do u expect a forces to defeat Taliban when they do this to local as frequent basic? The local just turn back to Taliban for help. US Coalition win zero percent help from Afghan local.
US could have really bomb Afghanistan back to stone age and spare no local to win the war but what will be the backlash for US from rest of world community if they do that?