The “well-regulated militia” thing is solely a STATE function. The individual’s rights, in addition to participation in a STATE function, ABOVE ALL and supreme to ALL are covered by the last part.....IOW it goes, “We the people”, the STATES (the rights we give them), and then the Federal Government (those rights not claimed by the STATES) delegated to the Federal Government.
As far as I’m concerned these United States are people, states, THEN Federal Government.