I've served on a jury, twice....and yes it works through challenges, and yes, the judge makes the decision.You've obviously never served on either a Grand or regular jury. The members of both are NOT chosen by the lawyers. In the case of a regular jury the lawyers on both sides have a small number of preemptory challenges and can challenge jurors for cause, but it's up to the judge if they are removed. I've served on both. The Grand Jury is effectively a rubber stamp totally controlled by the prosecutor who decides what information they can see and what witnesses they can call.
Where you are flat out wrong is your presumption the judge works for the prosecution....THEY DON'T.
the prosecutors work for the DOJ, an executive branch, the judge works for a constitutional separate entity, the Judicial Branch of government. In a trial, they are there as a NEUTRAL entity, making certain BOTH the defense and prosecution, have a fair trial....and justice is served for BOTH the defendant and the victims, and the citizenry in the public.....