That doesn't make any sense. They just sit in the outside of your ear. Nowhere near where earwax is produced.
There are other brands of in-ear headphones that you jam into your ear canal more like earplugs. Possibly those could have an effect. But AirPods Pro are nothing like that.
AirPods Pro are in ear, they compound the issue of earwax on your outer ear into a worse problem. That's according to me ear doctor, feel free to argue further with me but that's what he said.