Earlier quoted context omitted.
The supreme court, stacked or not, has no bearing over gun ownership, nor does congress. "Congress shall make no law […] the right to bear arms shall not be infringed." supercedes both of them.
Why did you start with the first phrase of the first amendment, redact the rest of that amendment and the beginning of the second, and then misquote the remainder? "A well regulated Militia, being necessary to the security of a free State, the right of the people to keep and bear Arms, shall not be infringed." Grammarians have been puzzling over this text for many years.
1. In the beginning everything in the Federal Constitution--and all the amendments--were understood to be only a restriction on the Federal government.
2. Many restrictions on the federal government were created out of states' concerns about it "going bad" and trying to ensure their own autonomy was protected.
3. The Second Amendment was drafted during the Articles of Confederation, at time when every state was required to support their own state-militia with arms/materiel, including guns-on-wheels that could be pulled by a horse, and the legislature had to appoint the upper-ranks.
So in combination, I argue the Second Amendment was wrongly "incorporated", abusing its original legislative intent of preserving a degree of state military autonomy. So on one hand, that means individual states can impose much stronger restrictions if they want, and on the other hand the federal government can't complain if your state lets you tow around a flak-cannon behind your truck.