Verifying schematic ideea: Circuit design for mosfet driven by ESP32
I think that the 3.3V voltage, although is above the Vgs(th), will be insufficient.

Nope, you're wrong. For a 5W load with VDD = 12V, the drain current will be around 400mA. If you check the transfer characteristics from the datasheet then you'll see that VGS=3.3V is quite sufficient ID = 500mA.
Here's a circuit you can use:



simulate this circuit &ndash; Schematic created using CircuitLab
R1 should be selected so that the signal at the gate of M1 should not be completely chopped off as R1 and M1's Ciss form a first-order LPF. For fPWM = 500Hz in your case, you can select fC=5kHz:
$$
\mathrm{f_c = (2\pi\ R1\ C_{iss})^{-1}  \\ 
\rightarrow 5kHz = (2\pi\cdot R1\cdot 1.7nF)^{-1} \\
\therefore R1 = 18k (max)}
$$
I selected R1 = 1k for proper operation with lower duty cycles.
D1-R2 couple guarantees a faster turn off for the MOSFET.

If you really worry about the ESP's IOs then you can use a totem-pole output:



simulate this circuit