Sell it shortly before its one year warranty runs out, always. Then take that money, and the money you save by not purchasing AppleCare, and with that you buy the newest generation model. Rinse, repeat.
It is more expensive than purchasing AppleCare and keeping your device for those three years. But in return you never have a Mac that is older than 11 months at the most, so the chances of hardware failure are lower than when you keep your Mac for multiple years. And you get to use the newest hardware. It's not a requirement, but it's certainly nice to have the latest gen tech.
There is no point in keeping your Macbook(Pro) for more than the warranty time nowadays. You can't fix any issues yourself, after the warranty runs out, just opening the current models is hard as the bottom plate is glued to the internals in addition to the screws.
Good luck spending an hour with a hairdryer heating up the glue just to replace the battery, and with battery I mean that questionable third-party replacement since you can't get an original without handing the laptop over to Apple. The display assembly is one entire thing where a panel replacement on another laptop would cost you 100 bucks and here it's multiple times that. The rest of the laptop is basically one entire mainboard that has memory and ssd soldered onto it. And even the 13" without touchbar let's you switch the SSD only in theory - there are no replacement SSDs unless you, again, hand over the laptop to Apple.
If you instead sell your Mac when the warranty is about to run out, you will make a loss but you won't have to spend the AppleCare money in the first place, and you never run into the risk of ending up with an expensive brick.
Sure, some of you buy a Mac without a warranty extension and keep it for 4+ years, assuming it will be fine. You'd have to spend so much more if you were to do it my way. But my way of doing thing isn't actually that expensive:
2000 usd up front, 200 each year after the first (loss of selling) -> 4000 usd in 10 years.
2000 usd up front, replace after 5 years then 2000 usd up front -> 4000 usd in 10 years, or a bit less if you sell your old Mac.
And I don't have the risk of being outside the warranty period ever.