I guess Iraq and Vietnam didn't get the message on this.
"Defeating" the military isn't the goal, in the same way that the goal of Iraqi and Vietnam insurgents was not the goal.
The goal is to make the conflict so expensive and costly that they decide not to continue it.
For example, imagine if those hundreds of thousands of uninvolved civilians that died in Iraq were instead innocent Americans caught in the crossfire of a war.
This would be an extremely high cost to the ruling government.
Yes, even if the government is "evil", because real life entities are not comic book villains.
They are rational entities with rational motivation. And presumably one of those motivations of any government, even an evil one, is to not rule over a desolate wasteland of ashes.
Or in other words, sure the government could launch hundreds of nukes and kill all of its enemies. But it would do that, because the government is not a literal doomsday cult.
The point of an armed citizenry is to act as a DETERRENCE. It is to increase the costs to the government by saying "yes, you can win this... But only by killing millions, and since you are not a doomsday cult, this is a high cost".
It is a deterrence in order to stop the government from becoming an evil dictatorship in the first place, kinda like have a nuke pointed at your own country.