Erratic Mega Output when connected to USB cable

It would have been good to mention your project was dealing with those sorts of currents to start with.

I feel you need some good solid industrial power supply decoupling solution like using pi filters with large inductors.

Can you link to your motor drivers.