Selecting the power source for load using MOSFETs only?
In principle this circuit should work, however here are two suggestions:

Remove the \$100k\Omega\$ resistor between VCC and the leftmost PFET. This resistor is slowing down the gate charging of the upper PFET during the VDC to BATTERY switchover. Meaning that, for a couple of miliseconds the battery might discharge into VDC if the latter \$VDC&lt; V_{BAT} - V_{BD}\$.

Add some capacitance at the node VCC in order to account for voltage dips during the switchover.


Update#1
The following simulation introduces a buffering capacitor \$C_1\$ which speeds up the gate capacitance charging of the upper PFET.
Essentially the capacitor \$C_1\$ is charged when the VCC is active, and once the latter is disconnected, the capacitor discharges into the gate capacitance of the upper PFET.