Of course this means that you're actually not doing the exact same thing at the same company all the time. A good company allows for that. Either because you can easily switch projects, switch teams, move up, move sideways etc. Depends on things like company size, structure, culture etc. And yourself obviously.
I found that the times in my career where I learned the most was when I hung around to face the consequences of my actions. That normally means staying longer than two years.
How do you learn if you don't have to maintain what you wrote after two years...? Also, creating connections and really understanding a company/business is really fun IMO.
Switching jobs I’d be doing the same thing more than if staying. That’s the thing. I have even switched occasionally but switched back out of boredom. I tried.
I’m in a position where the job is interesting (I find most work isn’t - I’d never want to work in a place making some Crud app or web service).
Very different. I cannot imagine staying anymore more than two years - aren't you bored?