I don't know who's smarter. Tails may be doing more with less, but he has his dope moments. Eggman is brilliant, but he doesn't surround himself with a team that can watch his blind spots.
Eggman's weakness isn't his ego. It's that he's... well, robotic. He's scripted. His master plan will try to account for every move his adversaries can make. He'll have backups upon backups. But he's up against Sonic, who is a master of winging it. Sonic will find the one move Eggman didn't plan for, because he doesn't know he's going to do it either until he does it.
Eggman's weakness isn't his ego. It's that he's... well, robotic. He's scripted. His master plan will try to account for every move his adversaries can make. He'll have backups upon backups. But he's up against Sonic, who is a master of winging it. Sonic will find the one move Eggman didn't plan for, because he doesn't know he's going to do it either until he does it.