The minimum PWM output frequency is 10 Hz. The maximum PWM output frequency is 8 KHz using writePWMFrequency(mypi, 12, 8000).
Perhaps use a i2c pwm controller chip.
You probably don’t want to dedicate one core of your raspberry to generate a pwm signal too cool the cpu just because you generate the pwm to cool ….
If you use a standard dc fan you need a mosfet and filtering to run your fan smoothly. You can perhaps get rid of some filters on higher frequencies but you run into hearable hiss or other noises and emi problems as you push spiky pulses along a wire
Quickly looking @ the spec they use the serial UART tx pin to drive the pwm. The serial controller probably able to generate the 25k.
So you probably take a look into that path.
But I’m not a raspberry expert. I would go the i2c path as it is always better to have real hardware pwm.