When a defendant takes a plea deal offered by the prosecutor, does that set future legal precedents?
No.
Or are future legal precedents only set when you go to a bench trial or a jury trial?
No. Indeed, the law is intentionally structured so that, given the same facts, different juries (and different judges) are allowed to arrive at entirely different conclusions. Concepts like "negligence" are intentionally devised as standards with an irreducible level of ambiguity.
The main form of precedent comes from publicly reported appellate court cases reviewing trial court rulings on the merits. The decisions are binding on courts whose decisions could be appealed to the appellate court in question, and are persuasive authority for other courts.
Most appeals in both civil and criminal cases, are from final orders at the conclusion of a trial. But some appeals are from pre-trial dispositive motions (that resolve the case prior to trial, e.g., on jurisdictional grounds) and many evidentiary rulings in criminal cases are from pre-trial motions (because there are not appeals from acquittals in a criminal case, so it is necessary to resolve them at the appellate level prior to trial).
Sometimes unreported appellate court cases and reasoned opinions of judges in motion practice or following a bench trial will be cited as precedents, but those precedents are not binding, they are only persuasive. They demonstrate that a real judge or judges adopted arguments that another real judge is being ask to adopt.