Yet the rule for centuries has been that they are immune. So your point is wrong. It is not a legal violation. As to what is moral, I express no opinion other than to suggest that the law has been viewed as at least a floor of morality for centuries, and the vast majority of people who understand how it works would disagree with you.
It's fine if you think that, but not only is that not the law, nobody would become a prosecutor if that was the law. Prosecutors are immune because the government can accuse anyone of a crime if it is supported by probable cause. The large gray area between probable cause and proof beyond a reasonable doubt doesn't give a person the ability to go after the prosecutor because the proof doesn't amount to enough to convict. This "we don't like how the system functions so we're going to attack the characters" is pathetic, childish crap that guilty people do every day in courts in this country, and for good reason, it goes nowhere.