An Uno/Mega has a reverse protection diode with an absolute max rating of 1Amp between the DC socket and V-in, so forget about powering anything that draws more than 1Amp THROUGH the Arduino.
Power for a motor driver has to go to the motor driver, and then (split) to the Arduino.
An Uno/Mega on 12volt is borderline.
It could already overheat and shut down with the current of an LCD backlight.
12volt to power a small Arduino, Nano/ProMicro/etc. is a big NO.
You must drop this to a lower voltage, or power it with e.g. a 5volt cellphone charger on the USB socket.
Leo..