Except that it's a myth.
Deterrence of undemocratic government was one of a whole pile of things that militias were for, and it was really a tiny part. The main purpose was because the US, when founded, didn't have a standing army or police force. In fact, men of appropriate age were required to own guns because the militias were the only military and police force.
The founding fathers, however, made their opinion on violent opposition to the government and civilian ownership of purely military hardware quite clear in Shays' Rebellion, the Whiskey Rebellion, and Fries's Rebellion. Frankly, the one thing that scared both the Federalists and Anti-federalists was the chaos and anarchy in France.
In fact, reading the evolution of the verbiage makes it rather clear the second amendment is less about private firearm ownership, and more about the state's right to maintained an armed militia when Congress was granted the right to raise a Federal army.
Over time those militias evolve into the National Guard and the State Police (or whatever your state calls them).
I'm all for private ownership of civilian firearms, and I'm firmly convinced 'gun control' should mean focusing on things like straw purchases and illegal sales. I also firmly believe you should have to take a mandatory safety course to buy a gun (well, the first gun at the least, maybe with retesting if so much time has passed but those are details). We need to get past the myth that the second amendment is about armed insurrection though.