ESP32 microcontroller generates noise on microphone
Implementing a filter was the right idea, however, your current filter works on frequencies above 10 kHz and is totally ineffective against the noise you have. You will need a much bigger cap to efficiently filter out that 10Hz signal.

At such a low frequency, using a passive RLC filter isn't very practical. I would suggest using a separate power supply here. If that is not possible, you could re-generate the supply voltage for the sound detector from ESP32 +5V supply using a DC-DC converter. Then you will only have to filter out the converter noise, which will be somewhere in 100kHz range.