The fighter doesn't really "shine" at being better at fighting than others until level 11. Barbarians, paladins, and rangers all have the same number of attacks from levels 1-10. The fighter gets action surge once per short rest, but the other classes get abilities that have a much greater impact on their combat capabilities overall (hunters mark, haste, smite, reckless attack, rage, etc). At level 11+ though the fighter does manage to barely climb to the top in terms of damage done, but is still behind the others in both utility and durability.
It depends on the Fighter build and it depends on what someone means by "better at fighting" (which can mean offense, defense, and/or the ability to be attacked more often so that the rest of the party isn't).
Sure, those Barbarians are not taking a lot of damage, but a Battlemaster Fighter with Parry and Heavy Armor Master isn't taking a lot of damage either, but can be doing more damage with Feint. An Eldritch Knight with the Shield spell and Heavy Armor Master isn't taking a lot of damage.
AC 16 Barbarian with two handed weapon and a foe with +6 to hit gets hit 55% of the time. 50% damage or ~27.5% damage (not taking into account criticals) if Raging which is a few encounters a day at lower levels.
AC 18 Eldritch Knight with Shield spell and two handed weapon and a foe with +6 to hit gets hit 45% of the time for 45% damage, unless he uses the Shield spell (typically for harder hitting foes) for 25% damage (35% and 15% if a Defense build). Throw Heavy Armor Master into the mix and that's like stopping the damage of one or more attacks per encounter at lower levels.
Another thing Fighters get is two additional ASEs, one at 6th and one at 14th IIRC. This equates to better Str, Con, or more feats.
At lower levels, an Eldritch Knight can wade in and cast Thunderwave. Sure, it doesn't do a lot of damage on its own, but it can do just as much as a low level Fighter (abet against multiple foes) and it can set up the rest of the melee PCs for advantage. Or he can cast Blur at level 8 and be significantly harder to hit than a Barbarian.
And of course Rage ends if the Barbarian has not attacked or taken damage since his last turn.
Action Surge, Second Wind. Even Great Weapon Fighting tends to mostly cancel out low level Barbarian rage damage boost. The advantage of lower level Fighters over Barbarians is that they tend to have more options. Low level Barbarians do fight better if they are raging, but in order to maintain balance, a DM might want to consider using the 6-8 encounters per day guideline to offset this advantage and/or use the Rage ending rules properly.
Similar things happen with Paladins and Rangers, but again, it's build (and DM encounter style and party makeup) dependent. An archer Ranger with the Archery style, Hunter's Mark, and Colossus Slayer can do sick damage (even without Sharpshooter and/or Crossbow Expert). But such a build is typically a bit more squishy than most Fighters and often has less survivability if targeted by multiple foes and in some parties, having an archer means having one less front line combatant (which might mean more potential attacks against other squishier PCs). Pros and Cons. I think people often compare two builds or two classes and do not realize that the synergy of how such builds work in given parties changes.