Oof yeah, I hate when they do that. I quite like the fact that in aoe4, rams can't even target units. So that particular pathing problem can't occur.
Though this is annoying when I play Byzantines and use the cheirosiphon, their unique ram variant that spits fire, since the fire will damage units that happen to get into its range, but I can't actually target units with it...