The problem is, perhaps ironically, that prosecutors and judges often know each other much better than people expect simply because prosecutors come before the same judges on a regular, continuous basis. A city of millions might have seventy or eighty trial court judges. If you, as a prosecutor, spend every day in Court for a decade, or two decades, it's not at all surprising that you'd be familiar with all the judges and know at least a bit about them.
There's nothing you can do about that unless you'd like to ensure judges and prosecutors never serve terms of any reasonable duration.