That's the concept of the separation of powers. Of course judges will have opinions and can never truly be objective (no such thing exists anyway), but their main job is to apply the law. And the concept of appeal and (in France) "cassation", which meana judgment can be revised up to two times, are there so that no single judge ruling can be definitive in isolation.
If politicians can use the judicial system to ban political opponents, the system is broken and powers are not separated in the right way. And I'll definitely not say that France has a perfect separation (the president concentrate a lot more than it should), but it's still there and this wasn't such a case (in the past two years, Le Pen and the RN is the group that Macron has been willingly compromising with and letting arbitrate a lot of stuff)