You can just change the constitution. And the highest judges in the land are all political appointees. And a judge is just as likely to be human garbage as a politician, just look at Jeff Sessions. Or they can be corrupted and/or threatened. A judge can quite literally say 'this is constitutional, actually' when it isn't, especially if the would-be dictator is clever enough to make their power grabs sufficiently ambiguous.