(How) can I run a microcontroller and DC motor from the same battery?
Well, there is nothing fundamental preventing the sharing of the battery.  

Of course, the battery must be properly rated for your load (max. current and series resistance).  The microcontroller needs a regulator and some passive filtering to isolate the voltage variations that the load will induce due to its varying current draw. 

Regarding layout, ensure that motor current does not flow through the traces/wires related to the micro.  In this particular design, that means that the battery's ground must first go to the n-mosfet's source, and from there to the micro and its regulator (instead of 1st going to the micro), or even better a star topology, with the center of the start as close as possible to the battery's negative terminal.  Otherwise you'll get a noticeable ground bounce that will damage/reset the micro.  

Additionally, keep all current loops as small as possible to reduce EMI.  In this case, this means keeping the wire that goes to the motor twisted/tied to the wire that comes back, and close to the mosfet as it follows the current loop.  This also applies to the gate circuit, but this is less critical.  

You should put a series resistance at the gate to limit the current draw from your micro's pin during transitions.  A pull-down would also help in keeping the motor off at power-up.  

Don't forget the flywheel diode in parallel with the motor, to prevent huge voltage spikes when turning off the mosfet.  You could also consider a snubber circuit to reduce transient spikes.

In your micro, make use of the watchdog timer so that the motor does not stay on if a hang occurs during an on time.  A more robust failsafe would be a high pass circuit at the gate, but this means your pwm duty cycle cannot be 100%.