I am pretty sure that the earliest "bolts" were actually threaded rods with a square plate on each end. Eventually someone decided that one end could be made with a head. Don't know if the first was simply a square heat welded on in a forge?
The first technique you refer to is often used to stabilise masonry walls which are bowing. We still do something similar today, although resin fiastenings have more or less taken over in recent years
I've seen a fair few old fixings in listed buildings but having done a small amount of forge work a few years back I seriously doubt that a welded head would be strong enough. I think it would also be much more work to forge weld the head of a bolt onto the shank. I suspect that before the invention of appropriate machinery the round, unthreaded bars would simply be heated at one end introduced into a square die with a hole in the middle of the recess and formed by hammer forging (into the shaped recess) in a similar manner to the way that rivet heads are formed by a hammer and die (both cold and hot). Forming a square at the end of a round bar by hammer work alone is possible, but the clean undersides to the many old bolt heads leads me to think they were forged using some form of die or at the very least a swage block.
Early threads weren't turned or rolled (machine lathes to do this sort of work would have to wait for Whitworth) but some show signs of hand cutting, although I wouldn't be surprised to find that they had been formed, at least in part by again heating the metal and using a die box to form the thread. I have seen quite a few smaller wood/coach screws which are definitely cast as a single piece