Good that you took action. sounds like you have it in a safe configuration. I'd tie up those halyards to the boat and not the dock. keeps boat motion from making odd tensions on the rig.
Hard to say what caused it but it could have been some corrosion at the first thread root.. I think I see rusty stains on the side of the rod and in the threads. The most common cause of a failure like that is fatigue.. but I have no idea how that could happen on your boat..Could be from misalignment .. when the plate is seated on deck, the rod tip should perfectly line up with the screw hole in the anchor. If you took a macro photo of the broken ends, a couple of guys on the forum may be able to give an opinion..
Welding.. if done correctly, it will be as strong as the original. It will be sensitive to SCC, (stress corrosion cracking) if exposed to some corrodents. Keep all chlorine solutions away from the weld! (seawater, bleach, Comet, etc)
If ya don't feel like welding, you could have a sleeve threaded on both ends. (the walls of the sleeve would have to be the same cross sectional area as the existing rod) Screw that onto the threaded nub then shorten a bit and thread the existing rod .. which could then be screwed into the threaded sleeve.. sealed with big goops of never seize
Again, good luck with the fix