> I never discussed compensation related things with my manager

Unfortunately, that's your mistake. I firmly believe that you don't get what you don't ask for. Generally speaking, managers (and I am a manager) often assume that if you aren't speaking up, you're happy with your job and they don't need to worry about you. Good managers will check in often and make sure that's actually true. Great managers will ensure that you are compensated fairly without you having to ask. But there aren't a lot of great managers out there, so...

The advice here is simple: speak up.

Pro tip: don't ask for a raise, tell them it's time for a raise. "Hey boss, I've been here for N years, my reviews are consistently good, and my level of responsibility has been increasing. It's time for a raise. Given my current salary, $Y is reasonable." Do your research and figure out what $Y should be for you. Be confident and clear. Don't say "I think" or "I believe". Just state facts. Try not to get emotional either.

Be clear about your career goals with your boss. The more explicit the better, IMO. "Hey boss, I'm currently a Senior Software Engineer. I would like to be a Principal Software Engineer by this time next year. How can we make that happen?" By stating it explicitly, you've given your boss a direction to go in and by asking for help, you've made it a team exercise. Both are very positive things and will make this all go smoother.

Do not compare yourself to anyone else, and certainly do not bring up anyone else's salary. "Fair" is not something the business believes in, but value is. If you know your own worth, you will get what you want. If they won't play ball, then it's time to look elsewhere.

In the future, you will have to learn how to promote yourself. The simplest thing to do is find a coworker that you trust and that you work well with and just ask them to say kind words about you to the boss. The more visible you are, the easier it is for the company to see value, and the biggest way to be visible is to have others speak on your behalf.

Another great way to increase visibility is to get more responsibility. Again, you don't get what you don't ask for, so be explicit. Ask for more responsibility. Any manager with any sense will wait until you demonstrate competency before you get promoted. You don't often get promoted to "Principal Engineer" unless you're already doing that work. Think of promotions as recognition for work already done, rather than permission to do that work. And the best way to make that happen is to ask for it.

Above all, stay positive. Don't say anything negative to anyone, don't bad-mouth anyone. Don't even mention the "undeserving" folks.

One final tip: forget about everyone else. The people you may think of as "undeserving" may be doing things that are simply unaware of. Managers aren't perfect, but they often have context into what the larger organization is doing that you may lack. I don't know the specifics of your company, but just keep in mind that you may not know as much as you think you do. Worst case scenario, those folks have been looking out for #1 and by all accounts have been successful at it. Now it's your turn. Look out for yourself.

Good luck!