On one hand there are places that will look out for job-hoppers so the 3yr rule is good. But for promotions, job-hopping is the best strategy.
The part people don't talk about much is the toll it takes on you when you switch jobs. It's like moving but worse. It's not like switching your wardrobe or something, it's a very drastic and intense change.
There really is no hard-and-fast rule with these things, you just have to figure out your industry, country, region and other details and determine what is best.
An advice I could have used earlier myself is the whole networking and building contacts thing. This is both internally and in your industry. There is literally nothing more important for your career than being likeable and building a reputation. Whether it's a promotion, better pay, or landing a better gig, focus on that as a priority.
In case what I'm saying isn't clear: be the biggest butt-kissing sycophant possible, and never be negative or disagree unless you're very confident that's absolutely what's expected of you by the right people. You don't get paid for how hard you work, you get paid for how valued you are. I think that's a bit obvious, but what many miss is that it isn't how valuable you are for the company that matters, it isn't even how valuable you are to your team, or to delivering some goal that matters. What matters is how valuable you are to individuals. Competency matters, but only as a 2nd or 3rd point of order. It matters how well you're liked, but also how good you are at improving how well-liked others are.
Sometimes there just aren't any opportunities where you are, nothing can be done about that other than jumping ship. However, expecting to be promoted, or paid more because of "the rules", that doesn't work well in real life.