It just does not work like that. It’s a simple maximization problem. If your ideal is science and engineering and good code then your value will only be recognized by people who share the same ideal and these people are usually not the one distributing money.
If your ideal is making money then you will do everything in the book to make sure that the ones that distribute it mostly distribute it to you. That means taking credit, over promising, transferring blame, sabotaging careers, networking, shmoozing, etc...
Sounds familiar? That’s the ABC of the corporate world. That’s why most large companies end up being steered by incompetent people (Peters principle, IOW the last level you can reach before your incompetence really shows and shmoozing is not enough anymore).
If money is what you are after, either stay in a big Corp and forget about technical excellence or start your business and pray. Or, realize that there can be other form of rewards than money for your excellence.