The Second Amendment doesn't say that militia is the
sole purpose of RKBA, and even the cursory reading of the state RKBA provisions that preceded the Bill of Rights, and which were the source of 2A, show that they specifically talked about "defense of self" and individual rights. Take a look at the list here, and note the years when those were enacted:
http://www2.law.ucla.edu/volokh/beararms/statecon.htm
For example, Pennsylvania had this in 1776, more than a decade before 2A was ratified:
"That the people have a right to bear arms for the defence of themselves and the state; and as standing armies in the time of peace are dangerous to liberty, they ought not to be kept up; And that the military should be kept under strict subordination, to, and governed by, the civil power."
Vermont had almost the same, word for word, in 1777.
The reason why 2A in the federal constitution doesn't really bother to mention this is mostly because it was in large part meant to be a contract between the feds and the states, protecting the latter from encroachment by the former. This is also why e.g. 1A says "Congress shall make no law" - and indeed, early on, it was perfectly okay for states to limit freedom of speech, subject only to their own state constitutions. The states had very real concerns about the feds trying to disarm their militias, since the Brits tried to do exactly that during the War of Independence; and that is why the militia clause is there.
But it doesn't mean that 2A is narrowly scoped to that rationale alone - the journals from the debates over the meaning of the amendment, and other correspondence between the participants (which are referenced by the Heller majority opinion, by the way, so they're not just inventing this interpretation) makes it clear that RKBA was seen as applicable on the broadest level:
"I ask, sir, what is the militia? It is the whole people, except for a few public officials."
- George Mason, Virginia Convention on Ratification of the Constitution
The reason why the issue with the lack of clarity didn't really arise early on is simply because the federal government didn't have the grant of power to pass legislation of this nature that would target individuals rather than states. The earliest 2A cases were attempts to reference it in disputes between states and citizens, and in those the courts have ruled that it is out of scope there (this was before the 14A incorporation doctrine). US v. Cruikshank was the pinnacle of that approach. But if you stick to that approach consistently, then you have to do the same with 1A, 4A, and 5A - there's nothing special about 2A that would make it distinct from all those. So the Heller decision didn't re-interpret 2A - it merely pointed out that 14A applies to 2A in an obvious way.
I also find it curious that you cite US v. Miller, even though the decision in Miller didn't say anything about membership in a militia, but rather the suitability of the firearm in question to militia service - the judges decided that a shotgun with a barrel shorter than 18" has no "reasonable relation to the preservation or efficiency of a well regulated militia", because "it is not within judicial notice this weapon is any part of the ordinary military equipment" (i.e. sawed-off shotguns are not used by soldiers). So Miller essentially said that 2A does not protect firearms that do not have a military purpose. Ironically, taken to its logical conclusion, this means that it protects exactly the kinds of firearms that are the most heavily regulated today.