If you take the last piece of advice seriously, compensation should be an afterthought when figuring out what you want to do. It's hard enough to figure out what you are interested in and find a role that matches your interest. Optimize with only that in mind and you minimize the chance of day-to-day misery. Switching roles primarily based on compensation (or prestige) is socially acceptable self-sabotage. If you're unlucky enough to succeed, you will quickly realize that there are still people making multiples of what you're making and the insecurity that drove the initial move will resettle.
It's important to realize that salaries are almost completely meaningless in the abstract as a measure of success. Pause to think about this for a moment as this is not a commonly held view. What can you say about an engineer, a teacher and a chef, all of whom earn a salary of $60k? Are they all equally successful? Is a loan shark earning $120k twice as successful? Is an artist earning $30k half as successful? You may have some moralistic or value judgements here but ultimately questions like this have no real answer, your perception of success is a mirror onto your values. If your values center around extrinsic things such as titles and salary, you will fail to realize them in a lasting sense. Play stupid games, win stupid prizes. With that belief, put compensation out of your mind. On 99% of days, your ability to make a direct change to your compensation is nonexistent. As the Stoics said, there are things within your control and there are things outside of your control, focus only on the former.
That said, there is the other 1%. These are the days in which you are shaping performance review discussions or negotiating offers. In these situations, obsess about the money. The hard dose of reality is that nobody will advocate for what you think is fair, the onus is entirely on you to (tactfully) petition for what you need. There are many great resources on negotiation so I won't cover specific strategies. Just know that all comp numbers are in some sense arbitrary. This does not mean that anything is possible, but this does mean that there is always room on the table to get more. Ask people in the role for their comp numbers if you can, most people are willing to share details if you ask for the right reasons. If you don't know anyone, scour the web for comp at similar companies, similar roles, or more senior roles and determine the absolute upper bound of what is truly possible. Negotiating for yourself is never going to feel comfortable, being obsessed helps you push through that discomfort. At the end of the day, you may still not get what you want; it's okay to not be excited about a role because of comp but make sure you weigh that against the initial excitement that got you to an offer.
Most importantly, make sure that once you've signed or settled performance reviews, repeat. That is, ignore compensation until the next 1% window. Salary can be an effective measure of your success in a given pursuit over time but optimizing for money is the ultimate trap. As captured elegantly by Goodhart's Law:
When a measure becomes a target, it ceases to be a good measure.