have u read the manga properly? code isn't a stupid villain, you just don't understand the full picture. kk has prescience and actually in multiple timelines, code actually wins, he defeats kawaki, consumes the chakra fruit, and destroys the planet. boruto isn't underestimating code, he's literally making calculated moves across timelines with koji to prevent the worst outcome.

Idk why but I always feel like Code is the fucking dumbest villain(?) I've ever seen in Naruto verse