We have an adversarial justice system, where each side is trying to "win." But I don't believe it is as Machiavellian as you seem to fear. Sure, each side has discussions with its prospective witnesses, to prepare them for their court appearance, but they certainly don't tell witnesses to only state what will benefit their side (whichever side). No, it's the lawyers' job to frame questions so that the information they are trying to elicit is presented, and witnesses are supposed to stick to the questions asked, not to go off on tangents of their own. They can and do say unexpected things, which can be a revelation, or a problem, or simply a diversion, depending, but normally the lawyers (and the judge) are trying to keep things on track.
The courtroom, however, is not the place for "the whole truth" to be told, necessarily. We here are curious about a lot of things related to the case, but that doesn't mean all of these are rightfully part of the court testimony. The jury has a huge amount of information to take in; it is essential that the focus must be sharp, and extraneous material, however interesting, should be saved for post-trial interviews, analysis, documentaries or what-have-you.
A lot of "character evidence" is excluded because it doesn't address whether the accused committed the crime in question; some will usually be introduced, in order for the jury to understand the possible motivations and actions of the accused (or other players), but strict limitations on this kind of evidence are imposed. So, too, are emotional digressions, whether they be remorse, anger at the accused, hostility for betrayal, shock and horror, whatever, because - and I think this is important - the trial is not about them. Hopefully some of these n'er-do-wells may sincerely repent of their conduct around this case - but their repentance doesn't belong in the trial. The trial is about getting the facts out as clearly as possible for the jury to make an informed, considered verdict.
But cross-examination is where testimony not favourable to the side which called the witness can come out. The defense attorney can be quite aggressive with Crown witnesses, ask leading questions, practically put words in their mouths, to elicit information believed important to the defense, and the Crown can do the same with defense witnesses. A lot of leeway is permitted on cross that is not permitted on direct. This is one way the adversarial system promotes fairness.
The judge also plays a big role here in determining when (or if) either side has taken things too far, and in limiting what evidence can be introduced. He or she is on the alert to prevent admission of testimony or evidence that might be cause later for an appeal or mistrial. When we hear what evidence was excluded we sometimes thing, "Bleep, the jury should have heard that and they would know what a Defendant X is," or something like that. But unless it's relevant to the crime in question, it should be excluded. The tell-all analyses can and should come later, but the trial needs a laser-like focus on the essentials.
Then, over the longer term, the fuller analysis can take place. I've always found that part more interesting than the trial process,but understand the relative importance of each.