> To form state-level militia.
Right, to expand on that a bit:
1. When the Second Amendment was written, there was already an active legal framework of "well-regulated militias" through the Articles of Confederation. [0] Every single state was required to run and fund their own militia.
2. The bill of rights was originally (pre-civil-war) purely a set of restrictions on the Federal government, nothing in it bound states. One of its explicit purposes was to preserve state autonomy from the (new, worrisome) federal layer being created.
3. Therefore Second Amendment was (originally) intended to prevent the federal government from sneakily disarming individual states by literally removing their pool of arms and volunteers.
Whether it should still mean the same after many years and other amendments is a much trickier problem, but the idea that it always meant an individual right to arms is a false mythology.
[0] https://en.wikipedia.org/wiki/Articles_of_Confederation