People always forget the part about "a well-regulated militia." "Regulation" by definition is from the government. The idea was to have citizen's militias that could be called up in case of need, rather than a standing army. Note that Article I, Section 8 of the Constitution limits fiscal appropriations for the Army to two years, unlike the Navy which has no such limit. Militias were to be funded as needed (for example, to repel an invasion), then disbanded when the crisis had passed. Citizens were to own their own firearms but were still to be under government regulation, to ensure that they were trained and available.
The idea that people could just buy whatever firearm they want with no oversight and no responsibility for defending the country would have been foreign to the framers of the Constitution.