The argument that the Second Amendment was included to serve as a counterbalance to the power of the government/military is historical revisionism. The original purpose of the Second Amendment was to preserve the slave patrol militias in the southern states. There’s a reason the Second Amendment says “State” instead of “Country.”
In fact, the Second Amendment was necessary to get the Virginia delegation’s vote for the new Constitution. At the ratifying convention in 1788, Patrick Henry said:
"Let me here call your attention to that part [Article 1, Section 8 of the proposed Constitution] which gives the Congress power to provide for organizing, arming, and disciplining the militia, and for governing such part of them as may be employed in the service of the United States…
“By this, sir, you see that their control over our last and best defense is unlimited. If they neglect or refuse to discipline or arm our militia, they will be useless: the states can do neither … this power being exclusively given to Congress. The power of appointing officers over men not disciplined or armed is ridiculous; so that this pretended little remains of power left to the states may, at the pleasure of Congress, be rendered nugatory.”
George Mason also had similar fears:
"The militia may be here destroyed by that method which has been practiced in other parts of the world before; that is, by rendering them useless, by disarming them. Under various pretenses, Congress may neglect to provide for arming and disciplining the militia; and the state governments cannot do it, for Congress has an exclusive right to arm them [under this proposed Constitution]… "
The main concern was that Article 1, Section 8 of the newly proposed US Constitution, which gave the federal government the power to raise and supervise a militia, could also allow the federal militia to take control of the state militias and change them from slavery-enforcing institutions into something that could, eventually, even free the slaves.
Patrick Henry was worried that the new Constitution’s power over the various state militias given to the federal government could be used to strip the slave states of their slave-patrol militias.
As a result, Madison changed the first draft of the amendments to address the militia issue to make sure it was unambiguous that the southern states could maintain their slave patrol militias. His first draft for what became the Second Amendment had said:
“The right of the people to keep and bear arms shall not be infringed; a well armed, and well regulated militia being the best security of a free Country [emphasis added]: but no person religiously scrupulous of bearing arms, shall be compelled to render military service in person.”
But Henry, Mason and others wanted southern states to preserve their slave-patrol militias independent of the federal government. So Madison changed the word “country” to the word “state,” and redrafted the Second Amendment into today’s form:
“A well regulated Militia, being necessary to the security of a free State [emphasis added], the right of the people to keep and bear Arms, shall not be infringed.”
It was only in the last 50 or so years has the idea that the purpose of the Second Amendment was to enable citizens to right up against the tyranny of the federal government. Like I said, it’s historical revisionism.