I grant you the Ninth Commandment clearly applies to the court room setting. The examples you cite once again underscore the rabbis' concern for the protection of the accused, as well as their determination to safeguard justice. Insofar as I can tell, a number of the "minor prophets" shared these concerns.
The commandment, though, predates both the rabbis and the prophets. The biblical text sets the giving of the commandments, including the Ninth Commandment, in the Exodus journey. Regardless of what one may believe about historical accuracy, we are free to try to imagine how the commandment might have been heard in such a setting.
Perhaps, for example, it was heard in contrast to Egyptian practice of the period. Frankly, I don't know if we know a great deal about ancient Egyptian law and justice. On the other hand, we may reasonably assume that slaves were often subject to injustice. I rather doubt the Egyptian overlords of the Hebrews needed more than one witness to pass judgment on a Israelite (take, for example, the story of Joseph's imprionsment).
Imagine the Hebrews wandering through the wilderness. For the first time in generations, they must try to fashion a society, and the model most near to hand is that of Egypt. Would it not be ironic and sad beyond words if the liberated ones wound up imitating their oppressors? So...perhaps the ninth commandment might be heard to say: "You shall not mimic the Egyptians and their brand of justice but shall instead adhere to a higher standard."
On a different note, I'm struck by an implication of the commandment: truth is required, if justice is to be done. Frankly, our modern civil and criminal justice system often seems more concerned with achieving convictions, acquitals, or deals than with arriving at the truth of a matter. The justice system, it seems, is in danger of being taken over by the business model and its bottom line mentality.
Finally, the commandment also carries personal implications. Again, try to imagine former slaves attempting to build a society. Questions of a justice system aside, bearing false witness against another would soon have led to quarreling and even blood feuds, tearing apart the group in short order. It's hard to bind yourself to your neighbor when your neighbor is libeling you!