I know some pretty competent O-4s...but also a TON of mouth-breathing field grade officers too. Hegseth sucks on his own merits (or lack thereof) as a person.
SecDef Lovett only rose to O-4 before going into the NYC business community and then becoming a Special Assistant to SecWar Stimpson in 1940. https://history.defense.gov/Multimedia/Biographies/Article-V...
SecDef McElroy came up through Proctor & Gamble, no government or military experience. https://history.defense.gov/Multimedia/Biographies/Article-V...
Just as a few examples of adequately-successful SecDefs coming from "unimpressive" paper resumes.