It was, those three words aren’t there by mistake.
Standing domestic armies were controversial at the time. They needed a way if a state was a facing a crisis it could grab a bunch of armed citizens, declare it a militia, and deal with the issue. Most of the signers were lawyers and they knew that there had to be a legally established procedure for this.
This is me being nice to them btw the issue was slavery and the fear of slave revolts.
And a few decades ago it got reimagined as a civil liberty. Which is clear from the text that it is not and is clear from the debates around the amendment at the time.