Optimus has seemingly proven capable of besting either foe every continuity it was depicted. I think Rodi and Megs would need to truly work together to defeat the legendary Optimus.
Galvatron would risk going nuts if he thought about the possible ramifications of this fight though... Provided he doesn't kill Optimis himself, there likely to win.
remember, Megatron
needed Hotrod's help to finish off Prime.
G2 Megs and a corrupted Rodimus though