Like most advances in technology, it may have happened by accident. Perhaps some substance spilled on the iron as the smith removed it from the fire. It welded better so he started to experiment with different substances till he found a flux that got good results on a predictable basis. I don't believe, before that, he had any idea that oxygen was preventing him from a successful weld. Probably was cussing evil spirits before the "accident"