Check out my thread on my idle problem after water pump replacement.
Out problems our similar, but a little different.
After reading the posts to my problems, and doing multiple searches on idle problems, it was obvious that the usual sources of idle problems are: mass air sensors, throttle actuators, spark plug wire 'ends', engine wiring harnesses, vacuum leaks. I was convinced that one of these was my problem.
My engine wiring harness was replaced at 107,000 miles.
We replaced the mass air sensor and that didn't help, so I put the old one back in.
We checked all the vacuum lines - the ones in front of the engine under the cover that go to the switch over valves - egr, and air pump, and they were connected. There is one vacuum line that is near the water pump and goes under the intake manifold - it's colored (green or blue??) and of small diameter. It was connected.
Bad spark plug wire ends are a frequent problem for idling problems, but mine were fine and also replaced at 127,000 miles, along with new plugs.
We thought the throttle actuator was bad, and I ordered one, but was afraid to install it for fear that it wouldn't solve the problem and I couldn't return it ($961 part).
Took it to the dealer and it was a vacuum leak at the intake manifold seal (gasket). It was causing fault codes of the O2 sensor and air mass sensor, which are likely fine, but the vacuum leak was screwing up their function.
So, your problem occurred after the water pump replacement, like mine, but it my case, it was purely coincidental.
Hope any of this helps.
2001 E430, Bourdeaux Red, Oyster interior.
1973 280SE 4.5, 170,000 miles. 568 Signal Red, Black MB Tex. "The Red Baron".