Rifles already existed at the time, and Ben Franklin invented electricity among other things. They knew where the tech was potentially heading.
They actually had masters that could machine barrels better than most that are produced today.
https://revolutionarywarjournal.com/how-colonial-gunsmiths-forged-musket-and-rifle-gun-barrels/Magazines had existed forever too
https://reason.com/volokh/2020/02/11/magazines-over-10-rounds-were-well-known-to-the-founders/A lot of soldiers