There are extremely capable athletes with terrible ego problems and there are people that legitimately fall into death spirals. There are those that talk the talk but don't walk the walk, as well as those that quietly sweat away in their pursuit of mastery.
Lacking confidence in something, judging oneself, etc are just being human. Pretty much everyone goes through that. Sure, some might project confidence in the face of the unknown, but that's just one of many coping mechanisms we have. "Laughing to not cry", screaming in fear when startled by a spider, YOLO, panic lies, etc are other similar mechanisms where we do seemingly illogical things in response to the respective stimulus.
And of course, people are multidimensional and topics/disciplines are multidimensional. You can't possibly be great at everything, but most are certainly capable of getting very good at something (even if that something is being a generalist in software engineering - which is itself a form of specialization in the grand scheme of society). And you might experience impostor syndrome at work but still be one of those people that think they're above average drivers or some such. Or you might experience it and be confident about your looks. Etc.
When you consider that reality isn't a flat 2D grayscale spectrum, it seems fairly normal that one would experience discomfort with their lackings when compared against one of infinite arbitrary scales.