The condition you describe of idle surge is very common in 3.5 engines. Your motor is running too fast. It is entering into a decel cut-off cycle.
Decel cut-off is a condition where injection is discontinued. The purpose is that while driving and decelerating (foot off the gas)no fuel will be delivered. This has been universal on all FI engines since those first D-Jet cars. Here are the conditions for decel cut-off on your engine (from memory so the numbers are approx): throttle closed, engine running more than 1800 rpm. Decel stops when the engine speed drops below 1200 rpm). Thus in your case you have 1800 rpm and get decel cut-off - then at somewhere around 1200 it cuts back on (it often drops much below 1200 in actuality), then the cycle repeats.
The 3.5s were the first MB D-jets and they had the criteria to close to actual conditions and your experience is common. The engine also was very sensitive to timing and a few degrees extra (which helps everywhere else) causes too high of a cold fast idle. The aux air valve also winds up setting the cold idle too high often.
To test my hypothesis just lower the idle or disconnect the throttle switch (the computer won't know the throttle is closed and decel cut-off will stop). The final answer will be achieving the right adjustments or replacement parts to keep the idle down.
Owner 24 bay BSC
Bosch Master, ASE master L1
26 years MB technician