The reality is that competence is a better path to success, including at the highest level, but it's harder, and it's not sufficient without demonstrating your impact and building relationships along the way. This doesn't mean giving up your values, but it does mean acknowledging that others perceptions of you is ultimately necessary, and it's not wrong to invest specifically in that perception above your mechanical work.
And the last thing I'll say is that you've got to find a way to avoid negative psychological loops and blanket judgments of the world. Ultimately if you are not bringing a constructive mindset why would someone pay you? If you're hung up on how others are getting ahead with embellishment and nepotism (or any other professional injustice you've experienced) then you're just wasting energy and mental juice on things that are completely outside your control, and can only serve to hurt your chances of success.