Presumably the claim that (all) such laws are unconstitutional is based on a reading/extrapolation from Heller 2008 SCOTUS case.
District of Columbia v. Heller, 554 U.S. 570 (2008), is a landmark decision of the Supreme Court of the United States. It ruled that the Second Amendment to the U.S. Constitution protects an individual's right to keep and bear arms—unconnected with service in a militia—for traditionally lawful purposes such as self-defense within the home, and that the District of Columbia's handgun ban and requirement that lawfully owned rifles and shotguns be kept "unloaded and disassembled or bound by a trigger lock" violated this guarantee. [...]
As for your final quote, somehow that's oddly in the same case law:
It was the first Supreme Court case to decide whether the Second Amendment protects an individual right to keep and bear arms for self-defense or whether the right was only intended for state militias.
On June 26, 2008, the Supreme Court affirmed by a vote of 5 to 4 the U.S. Court of Appeals for the D.C. Circuit in Heller v. District of Columbia. The Supreme Court struck down provisions of the Firearms Control Regulations Act of 1975 as unconstitutional, determined that handguns are "arms" for the purposes of the Second Amendment, found that the Regulations Act was an unconstitutional ban, and struck down the portion of the Act that requires all firearms including rifles and shotguns be kept "unloaded and disassembled or bound by a trigger lock".
And a quote from the actual decision:
(1)(a) The Amendment's prefatory clause announces a purpose, but does not limit or expand the scope of the second part, the operative clause. The operative clause's text and history demonstrate that it connotes an individual right to keep and bear arms. [...]
(3) The handgun ban and the trigger-lock requirement (as applied to self-defense) violate the Second Amendment. The District's total ban on handgun possession in the home amounts to a prohibition on an entire class of "arms" that Americans overwhelmingly choose for the lawful purpose of self-defense. Under any of the standards of scrutiny the Court has applied to enumerated constitutional rights, this prohibition – in the place where the importance of the lawful defense of self, family, and property is most acute – would fail constitutional muster. Similarly, the requirement that any lawful firearm in the home be disassembled or bound by a trigger lock makes it impossible for citizens to use arms for the core lawful purpose of self-defense and is hence unconstitutional.
Since your argument ("in case some tyrant attacks, you almost certainly have hours to form a militia") is one about timing, the time to take a gun out of a vault is presumably similar (or longer) to the one to unlock its trigger lock. And since Heller decided that the latter was unconstitutional, one can easily make the argument that mandating storage in a vault fails (the scrutiny tests) similarly.
This didn't make into the final decision but was heard in the oral arguments in Heller:
however, another possible objection to the safe storage
requirement: not that it criminalized acts of armed self-defense, but that it
impermissibly burdened armed self-defense by making it too hard to use a gun in
a moment of need. This was the thrust of a series of questions from Chief Justice
Roberts and Justice Scalia:
CHIEF JUSTICE ROBERTS: So how long does it take? If
your interpretation is correct, how long does it take to remove
the trigger lock and make the gun operable.
MR. DELLINGER: You – you place a trigger lock on and
it has – the version I have, a few – you can buy them at 17th
Street Hardware – has a code, like a three-digit code. You turn
to the code and you pull it apart. That’s all it takes. Even – it
took me 3 seconds.
JUSTICE SCALIA: You turn on, you turn on the lamp next
to your bed so you can – you can turn the knob at 3-22-95, and
so somebody –
MR. DELLINGER: Well –
CHIEF JUSTICE ROBERTS: Is it like that? Is it a
numerical code?
MR. DELLINGER: Yes, you can have one with a numerical
code.
CHIEF JUSTICE ROBERTS: So then you turn on the
lamp, you pick up your reading glasses –
(Laughter.)
MR. DELLINGER: Let me tell you. That’s right. Let me tell
you why at the end of the day this doesn’t – this doesn’t matter,
for two reasons. The lesson –
CHIEF JUSTICE ROBERTS: It may not matter, but I’d like
some idea about how long it takes.
MR. DELLINGER: It took me 3 seconds. I’m not kidding.
It’s – it’s not that difficult to do it. That was in daylight.
The other version is just a loop that goes through the
chamber with a simple key. You have the key and put it together.
Now, of course if you’re going – if you want to have your
weapon loaded and assembled, that’s a different matter.
It's worth noting however that Heller ultimately struck down the law in question for the more direct reason that it was interpreted to require the lock to be in place at all times except in a prescribed list of circumstances that (fatally for DC) didn't include defense at home (they expressly did allow it, e.g. even for recreational shooting.) This is despite the DC arguing that there was an implied self-defense clause. So, while the time to use the gun was part of the banter in court, it didn't make it in the final decision. Thus one might say that Heller actually left the issue of time-to-ready unresolved. But given the relative ridicule that some justices heaped on the trigger lock thing (in the exchange above), one might guess [how] they'd consider the (timing) burden issue again if it came up in a related case.
The "prefatory clause" about militia actually did factor in a bit in the decision, but not in the way you say/expect:
"[O]rdinarily when called for [militia] service [able-bodied] men were expected to appear bearing arms supplied by themselves and of the kind in common use at the time." 307 U. S., at 179." "We therefore read Miller to say only that the Second Amendment does not protect those weapons not typically possessed by law-abiding citizens for lawful purposes, such as short-barreled shotguns." "It may be objected that if weapons that are most useful in military service – M-16 rifles and the like – may be banned, then the Second Amendment right is completely detached from the prefatory clause. But as we have said, the conception of the militia at the time of the Second Amendment's ratification was the body of all citizens capable of military service, who would bring the sorts of lawful weapons that they possessed at home to militia duty."
Who am I to criticize SCOTUS, but TBH this last bit sounds rather circular: M16 banned for civilian use [because!] -> not commonly possessed at home (unlike semiauto variant AR-15) -> ban of M16 is therefore constitutional. So the scarcity at home of an item (possibly/probably itself caused by a law/ban) is taken as an argument that banning that item was constitutional. I mean, if you're gonna drop a "bad guy" robbing your house at close range, wouldn't a 3-round burst be more of a sure thing? That's precisely why the M16 even has the feature. (It's less precise that way at long range.) So, if that's a useful feature for the military [at close range], I'm rather sure civilians would have it too for the same reason. But it was banned for civilian use, and so it became uncommon among civilians, and so it's argued that that ban is constitutional because the item/feature is now scarce among civilians' possessions. SCOTUS!
(For the nitpickers, only the currently-in-service M16A4 has that 3-round burst; older models had 'full auto'. As wikipedia says "The reason for this replacement was the massive waste of ammunition and very poor performance of soldiers who fired their rifles in fully automatic mode during the Vietnam War".)
One can even argue that the "bump stocks" and similar items that attempt to circumvent that kind of ban are prima facie evidence that that ban was imposed to curtail an actual demand. Of course, there's the more complicated argument whether that demand is mainly from "law abiding citizens" or would-be mass murderers.
And I'm kinda guessing this Q was in part asked because the latter happen to be in the news with SCOTUS tied in again:
February 29, 2024
The Supreme Court on Wednesday appeared open to upholding a Trump-era ban on bump stocks as devices that turn weapons into rapid-fire illegal "machine guns," however it was not clear that a majority of justices would ultimately back such a ruling or agree on the rationale.
During oral arguments in the case Garland v. Cargill, both liberal and conservative justices suggested the devices – which allow a shooter to fire a semi-automatic rifle more rapidly and accurately – pose a significant danger and could reasonably be considered the types of weapons Congress sought to outlaw in the 1934 National Firearms Act.
"Can you imagine a legislator thinking we should ban machine guns but we should not ban bump stocks?" asked Justice Samuel Alito.
"There was significant damage from machine guns, carnage, people dying, et cetera. And behind this is a notion that the bump stock does the exact same thing," noted Justice Clarence Thomas. "So, with that background, why shouldn't we look at a broader definition?"
But interestingly enough, the fact that some possess such devices already did give some pause to [some of] the justices:
"It's going to ensnare a lot of people who are not aware of the legal prohibition," said Justice Kavanaugh, echoing Gorsuch. Justice Alito also called potential prosecution of people who had legally purchased bump stocks as "disturbing."
Argument from prior possession again--like in Heller for handguns. Or perhaps better said more suggestive of how new machine guns were banned from 1986 onwards under (the possibly ironically titled) Firearms Owners' Protection Act. (To be fair, this latter ban was added as a rider/amendment to that legislation which ostensibly put checks on ATF abuses.)
But to get back to the main topic, the NRA for instance argues that such (safe storage) laws are often redundant and intended to deter legal ownership. Here's a typical argument:
if acting recklessly with firearms around children is already illegal, why would gun control advocates bother to make it even illegaler with mandatory storage laws?
Because mandatory storage laws aren’t about reducing unauthorized child access to firearms. These laws target benign conduct and are about stigmatizing and encumbering law-abiding gun owners and placing restrictions on how responsible parents can introduce their children to firearms and the shooting sports. As with all gun control, the overarching goal is to discourage gun ownership and eventually eliminate it.
Take for instance another mid-Atlantic state, Maryland. MD Code, Criminal Law, § 4-104, titled “Child's access to firearms,” provides,
(c) A person may not store or leave a loaded firearm in a location where the person knew or should have known that an unsupervised child would gain access to the firearm.
But this statute isn’t necessary. MD Code, Criminal Law, § 3-204, the state’s reckless endangerment statute, provides,
(a) A person may not recklessly:
(1) engage in conduct that creates a substantial risk of death or serious physical injury to another;
This statute has been used to prosecute those who keep firearms in a reckless manner accessible to children. The fact pattern in the case Tabassi v. Carroll Country Department of Social Services (2018), makes clear that a defendant was convicted under both Criminal Law, § 4-104 and Criminal Law, § 3-204 for keeping a firearm in a reckless manner accessible to a 12-year-old child.
However, this hasn’t stopped anti-gun Maryland lawmakers from trying to pass further legislation dictating just how law-abiding gun owners store their firearms and micromanaging how they can introduce their children to shooting.
Whether it’s a child endangerment statute, a criminal negligence statute, or a reckless handling of firearms statute, states already prohibit actual reckless behavior with firearms around children. The statutes may look different and may not reference firearms explicitly, but the prohibition on reckless conduct involving firearms is clear.