Legislators are there to directly reflect the opinions and interests of their constituents, judges are there to have expert knowledge of the law and how it applies to each case uniquely. The first needs some form of democratic mechanism to ensure that they represent people’s current opinions, the later needs a meritocratic mechanism to ensure they are experts in the correct fields.
If judges were the only element of a court I would agree that it would be problematic to have no democratic input, but in common law systems at least that element is represented by juries who are the most powerful element of a court case as they are unchallengable arbiters of fact and drawn through sortition which is even more democratic than election.
This is ideology. There’s no material mechanism to actually ensure judges are experts or have merit. They’re just picked by politicians, who themselves are selected democratically rather than by merit.
This just cuts out the middlemen. If the selection process is unable to select for merit, then it might as well be democratic.
The UK has an independent Judicial Appointments Commission.
Which can be overruled by an elected official but generally is directed to pick on merit and allowed to do so.
Allowing professionals to pick experts and only stepping in when there is a problem is much better to me than direct elections which quickly become partisan and obstructive to professional candidates.