It pains me to say this, because their general views about "freedom" and "rights" are so silly, but their belief does actually have some historical basis. The term "well-regulated militia" first came from the 1776 Virginia Declaration of Rights, and the language around that was clearly imported into the second amendment. That clause talked about the preference for a militia composed of ordinary people, as opposed to a professional army ("standing armies, in time of peace, should be avoided as dangerous to liberty"). This was a relatively common view at the time. So if you consider the only relevant source of truth to be what people thought when they were writing the constitution, there is good textual evidence supporting a vision was of militias composed of people subordinated to the several states, and the preference for that was in part driven by the fear of concentration of power. It's not exactly the same as saying, the people have a right to rebel against unjust government and it is precisely for that reason that we allow them to bear arms: because that right to bear arms is protected by precisely the government that they would, in this scenario, be rebelling against. But there is some common ground in the thinking.
This was clearly not a unanimous vision. The articles of confederacy had a much stronger role for the federal government in controlling an army, though the language was watered down a bit when it became article 1 section 8 of the constitution. The second amendment was a further compromise on that due to the discomfort of a few states with where the constitution had ended up. And that's the point - it was a compromise between a certain set of individuals at a certain point in time. Relevance to us, now, is about zero.