Yes it does, but it does not modify "right of the people". The people included more than just the militia, even then. You could be overage, or otherwise disqualified from militia service and still be a freeholder who could and did vote. But even those who could not vote, still had the right to peaceably assemble, and the right to be secure in their persons, houses, papers and effects, against unreassonable searches and seizures. They also had the other rights "retained by the people".
Conversely, there were some in the Militia who didn't qualify. Yes, there were exceptions. But I think it's unwise to define the right by the exceptions.
It's clear the second amendment was meant to protect the formation and existence of the state Militias. State constitutions took care of the rest.