Well, it says the right of “the people”.
Not “the militiamen” or “the army”.
To suggest that they meant it to be otherwise is like saying “the people” don’t have a right to free speech, only “the publishers” or “the media”.
“A well educated electorate being necessary to a free state, the right of the people to keep and read books shall not be infringed.”
The first subordinate clause has no effect on the main clause. In this example, books cannot be restricted to those in school, or those who are well-educated.
“The moon being made of green cheese, the right of the people to keep and bear arms shall not be infringed.”
Same issue. It’s basic English.