I think only when the water fills a spot which shares the wall that the dwarves have dug the stream would get stagnant.
Sorry to belabor the issue, but what if all the shared wall contaminations, other than the obvious problems with pumps, are caused by toads and turtles moving between the stagnant water and the river? I've been experimenting with digging cisterns and channels that share walls with stagnant water and haven't been able to contaminate my brook, but I just noticed toads and lizards hanging out around another stagnant pool farther downstream, and now the brook near that pool is stagnant.
Also, where my brook is stagnant, on a few occasions, I have noticed that the stagnant water only moves about 7 squares upstream, and doesn't spread farther, at least not for the years I've observed the behavior. Fortunately, I don't have any stagnant pools anywhere near the upstream half of the brook. Perhaps the solution is to cap off all your stagnant pools before the toads can invade your clean water.