The repeat offender you mention isn't a repeat offender until he's actually convicted. Innocent until proven guilty and all. So, you don't need to and should not apply a deterrent to an innocent person. Jailing before trial addresses the practical matter of how you make sure an accused shows up for the trial. We're much better equipped to do that without jail now than we were in the 18th century. It shouldn't be used as part of the punishment or a deterrence because the people it applies to are innocent until their convictions. But the insidious part is that it is used as leverage in the prosecution, to get guilty pleas out of people who can't afford bail, including out of actually innocent people.
Right, the deterrent for criminal activity is the sentenced jailed time, not jail time while awaiting trial.