driving 2 12v 2A DC motors with Mega

Optical sensor to the Single-head pump

What optical sensor? I see no optical sensor in any of the links.

Is this a sensor that counts motor rotations or something else?

There are many types of "optical sensor". We need more information about your sensor. What is the sensor sensing?

So I would need to run the sensor in-line with the mosfet between the gate and the arduino?

No, you would connect the sensor to the Arduino, read the sensor with the Arduino and control the motor based on the data from the sensor and some rule(s).