Breh that's literally how the Afghan War finally ended just 8 months ago - with the entire Afghan military giving up and refusing to fight.
If you want to go to a huge engagement, that's also how World War 1 ended. First the Russians began abandoning the front lines by the hundreds of thousands, forcing Russia to pull out of the war and eventually leading to the entire Russian Empire's downfall. Then the Germans refused to fight, forcing their government to try to seek peace and leading to their downfall as well.
Between Acceptance and Refusal - Soldiers' Attitudes Towards War (Russian Empire)
Kiel mutiny - Wikipedia
Another example is the downfall of the Italians in World War 2. This is often painted as some sort of cowardice or poor leadership or lack of supplies, but the reality is that thousands of young Italians forced to fight really didn't give a shyt about Mussolini and especially Hitler and didn't want to die for their stupid war. Engagements like Operation Compass where 130,000 Italian troops quickly surrendered to 30,000 British troops are portrayed as masterclasses in strategy by war gurus who don't want to accept that in reality sometimes soldiers just don't want to fight for that bullshyt.
https://en.topwar.ru/178180-operacija-kompas-katastrofa-italjanskoj-armii-v-severnoj-afrike.html
Going way back another example is how New Amsterdam became New York cause the Dutch governor was an a$$hole and no one wanted to fight for him, so when the British attacked they just refused to fight and surrendered to the British instead.
New Amsterdam surrendered to the English | History Today
Another example that same century is the Glorious Revolution, where William III of the Dutch Republic marched into England and the Royal Army immediately switched sides because they didn't want to fight for King James II
Glorious Revolution - Wikipedia
Going further back in history, Emperor Yang's dynasty ended because his soldiers got sick of fighting battles they felt were useless and didn't believe in, so they were going to just flee, but got worried they'd be hunted down and killed so they mutinied instead and killed the Emperor, ending the war
Yuwen Huaji - Wikipedia
Lucullus lost the Battle of Zela and had to abandon the Mithridatic Wars because his soldiers refused to keep fighting
Battle of Zela (67 BC) - Wikipedia
And like I said before, the downfall of Marcos in Philippines in 1986, the downfall of Ben Ali in Tunisia in 2011, and the downfall of Mubarak that very same year were all because their armies refused to fight against a nonviolent rebellion and turned on their own ruler instead.
Military Urged to Stop Supporting Marcos
How Hosni Mubarak misread his military men
When do militaries side with protestors?
Those are all only the more obvious ones - in reality lack of morale and end of desire to fight is part of the reason a lot of wars end. It's just that military historians and strategists tend to want to focus on the "great men", and not acknowledge how much impact the regular soldier can have on deciding events. One exception I can think of is Leo Tolstoy, who in War and Peace basically says the generals have no control over events at all and are just reacting to what thousands of men and events have already decided for them.
Population of Ukraine is 44 million, a hundred thousand defecting soldiers would be 0.2%. Doesn't even register in terms of taxing resources. Not to mention if necessary they could simply join the refugees and defect to any of the surrounding nations.