Older bikes for instance were air cooled so there was room to to up and over the motor as there were no radiators, this also kept the hot pipe away from the cooling fins
early liquid cooled bikes followed this methodology too, Im not really sure why... packaging for sure and perhaps crash protection
late model MX pipes are purely for packaging purposes and to minimise crash damage.
Heck you could get 10 more hp out of a 250 MX bike by putting an underslung large diameter expansion chamber on the bike.
only ploblem would be that you would crush the pipe the first time you landed a jump!
see what I mean?
every design is some kind of compromise or tradeoff