Can't a law be passed that states prosecutors legally cannot consult or assist in cases or for defendants they were involved with during their tenure as a prosecutor for X years after they leave their position?
It's like trying to separate church and state in England back in 1600-1700s.
It is the same problem - bribery/corruption but hard to proof and not much interest to investigate.