25kHz PWM signal to analog voltage (DC) using low-pass filter: Weird output

This is a real low pass filter case.
You have to consider that there are several influences... one importamt point is that you should not simply charge the capacitor, you also have to discharge it...
The complexity is well discussed here: how determine the RC time constant in PWM digital to analog low-pass filter? - Electrical Engineering Stack Exchange