I want to create a stable 0-10 V DC output from a 3.3V PWM signal (arduino/esp8266)
Your 3.3 V to 10 V circuit has some limitations.

I propose to try this circuit:





R1, R2 and Q1 are a 3.3 V to 12 V levelshifter for the PWM signal.

R3 and C1 filter (average) that PWM signal so we get a (more or less) constant DC voltage.

The opamp buffers that voltage. I used a TLC271 because it can operate rail-to-rail and can handle a 12 V supply. Maybe a TL071 (or TL081 which is similar) will also be good enough but these are not rail-to-rail opamps.

The output voltage isn't actually limited to 10 V, it can become 12 V but I'm assuming that the fan can handle that. The opamp cannot deliver much current anyway so there's almost no chance that anything will break if the opamp outputs 12 V.