An excellent piece of logic. Why indeed would you even think about inventing a nut if you didn't already have something like a bolt to put it on? Of course you might also ask why invent a bolt if there's nothing to screw into it?
But the first bolt might have been more like a wood screw than anything else, ie a spike with a crude spiral thread on it. I have only one reservation; was the Archimedean screw - which is just a very long nut - invented before or after the woodscrew?