Your mindset should be like this:
Think of buying a house. You want to buy; a seller wants to sell. You haggle over a price, and if the price is acceptable to both of you, you agree. The price might be higher than you'd like if there aren't many (or any) alternatives; it might be lower if there are lots of alternatives. There is no "correct" price. Only an agreement.
Your salary when you join is just like that. Salaries go up if skills are scarce. They go down if skills are plentiful. There is no "fair" salary.
The hard bit is realising that that's still true once you're inside an organisation.
Your salary might be lower than average, but you won't leave because you like your team or the location or the mission of the company. Just as you'd pay more for a house because it's near your kids' school, or near a lake or a beach or whatever you like.
Your salary might be higher than average, but you won't stay because you're treated badly, or the commute is far or somewhere else is willing to pay more. Just as you'd potentially move to a neighbourhood you don't like to get your kid into the school you think would be best for them.
Tl;dr: you have agency. It just doesn't feel like it when you think of employers as powerful and you as weak. Your best safety net is other employers. And you need to exercise your agency in these ways:
- talk to your boss about salary. Do you have pent-up frustration about your boss not initiating this conversation? You're just as capable of initiating it. Just as a house seller shouldn't get silently angry at an offer they don't like - they should respond with a no, and a counter-offer. Just talk. And go in with everything you want. Can't get a higher salary? What about a couple more days of annual leave? Or some training you really want to do? Or an internal transfer to another country? Think of all the things you would like, and see what you can get. If they end up offering you some things from that list, you can see if you like the look of the new package in total and stay, or decide it's still not worth it for you.
- if talking doesn't get you what you'd like, accept it and start quietly looking for new jobs. Ideally you'd be doing this all the time, but it is a lot of effort. Start here. Understand if where you are is your best option, or not. Remember there's no fair salary or anything like that. It's just like buying a house. You might already be in the best house for you.
- if you decide there are better options out there, then you have to get them to accept you! If you get an offer you like, accept it. Tell your boss, and don't accept a counter. And don't hold it over your boss. It would be weird to go back to a house-buyer as a seller who got a higher offer elsewhere and boast to them about the better offer you got. Just be polite and professional.
- enjoy your new job! Or if you decided to stay, your current job!