I realise that I'm a bit late to the party (and also that my answer is not specific to ubuntu-mate), but here goes...
I have very similar requirements to you but I run xfce on debian 9 (stretch) so I have no gnome/gsettings installed. To disable/re-enable the synaptics touchpad whenever I plug-in/unplug a usb-mouse, I use udev rules to trigger a (posix) shell script that unbinds/rebinds the synaptics touchpad driver:
As root, create /usr/local/sbin/touchpadctl.sh with the following contents:
#!/bin/sh
set -o errexit #(equivalent -e)
set -o nounset #(equivalent -u)
usage(){
echo "Usage: ${0} {-enable|-e|-disable|-d}"
}
if [ $# -ne 1 ]; then
usage
exit 1
fi
base_dir=/sys/bus/serio/drivers/psmouse
device_id=serio1
if [ ${1} = "-disable" -o ${1} = "-d" ]; then
logger "${0} is disabling the touchpad"
echo -n manual > $base_dir/bind_mode
echo -n $device_id > $base_dir/unbind 2>/dev/null || true
elif [ ${1} = "-enable" -o ${1} = "-e" ]; then
logger "${0} is enabling the touchpad"
echo -n auto > $base_dir/bind_mode
else
usage
exit 1
fi
Make your touchpad control script executable:
sudo chmod +x /usr/local/sbin/touchpadctl.sh
Now test out your script. To disable the touchpad:
sudo /usr/local/sbin/touchpadctl.sh -d
and to enable the touchpad:
sudo /usr/local/sbin/touchpadctl.sh -e
Because this uses "driver unbinding", there is no dependency whatsoever on X/xorg/wayland/gnome. As a result, you can use it in udev rules that will function correctly during boot-up:
As root, create /etc/udev/rules.d/01-touchpad.rules with the following contents:
KERNEL=="mouse*", ATTRS{phys}=="usb*", ACTION=="add", \
RUN+="/usr/local/sbin/touchpadctl.sh -disable"
KERNEL=="mouse*", ATTRS{phys}=="usb*", ACTION=="remove", \
RUN+="/usr/local/sbin/touchpadctl.sh -enable"
As with all things linux, your mileage may vary - you might need to "tweak" it, but I've tried my best to make it easy to understand. For more information re driver binding/unbinding, read Greg Kroah-Hartman's 2005 article in Linux Weekly News and there's also some good info in the kernel source. For more information re writing udev rules, have a look at Daniel Drake's excellent tutorial.