ifplugd(8)
is a system daemon that that does things when interfaces are hot-plugged (or otherwise go up or down)
According to the ifplugd(8) man page for your version of Ubuntu…
FILES
[...]
/etc/ifplugd/ifplugd.action: this is the script which will be called by the daemon whenever the state of the interface changes. It takes two arguments: the first is the interface name (eg. eth0), the second is either "up" or "down".
So it seems like you need to edit the /etc/ifplugd/ifplugd.action
script to do the right things to bring Wi-Fi back up when it goes down. I'm guessing that the /etc/ifplugd/action.d/ifupdown.sh
path is specific to Raspbian.