I thought this was a cool idea, so I looked around for existing implementations and found https://github.com/barre/privaxy
Been a while since the last commit, so I'm not sure if it's maintained, but I might try adding it (or something similar) to my pihole.