A state can't violate the second amendment- it does not apply to the states except as it's considered a privelege or immunity under the 14th amendment.
The example you gave clearly violates the individual right if the second is incorporated as it was meant to apply to the feds so I don't see your point.
Yes, the militia was inferior. That was well known even before 1812.
It was also well known that a standing army has certain drawbacks too,
Correct. No matter what the second amendment means, it only applies to the federal government.
So if a state, today, confiscates all weapons from its citizens and stores them in a secure state armory for use by the citizens when needed, that would not violate the second amendment (or any other part of the U.S. Constitution). Yes?
So, how does the second amendment ensure that citizens "would not be barred from keeping the arms they would need when called forth for militia duty"? It doesn't.