For example, I know people that look for higher paying jobs so they can work 2 years and not work 1 year. So the “spending 8 hours a day with a team” calculation is very different. You are looking for a higher paying job precisely to not need to spend 8 hours with people working. Which kind of applies to everyone when you give the option to retire earlier and have good money to take care of themselves and their family when old. You are earning ore to work less.
Lastly, you seem to apply a correlation between higher paying jobs and not liking people I your team. In my opinion, there is zero correlation. So leaving a job for a higher pay doesn’t mean at all that you will find a team that you enjoy less working with. The chance of actually enjoying more is just the same.
If you happen to find yourself in a team that makes you unhappy, but all means, leave immediately. But not changing jobs to a earn more because tou are afraid it will be a team that you will enjoy less working is the wrong thing to do.
I think looking for a higher pay (be it by negotiating promotions in the same company or by changing jobs) is almost always the right choice. And I do not mean in the “greedy” sense, I mean that is a very effective way to achieve more happiness.