Purpose of MOSFET in this circuit
Your guess is correct. When VBUS is not present, the gate is pulled low, and the MOSFET shorts out the body diode, connecting VBAT directly to the LDO.

When VBUS is greater than VBAT, the MOSFET is cut off and the body diode is blocking, disconnecting VBAT from the circuit.