Keith Foulke walked away from $5M. Dempster walked away from $8M, but he had already earned $89M over his career.
Pedroia would be walking away from $25M. There is no way he is going to do that, nor should he.
Does a buyout necessarily mean he'd be taking less money? Couldn't they offer the whole $25M right now, up front, in order to be done with the contract and free up the roster spot? That's arguably a better deal for Pedroia as $25M now is worth more than $13M next year and $12M the following year. Then he has his money, he can officially retire (if he wants), get the clock started on his Hall of Fame candidacy (outside chance but still a chance), and otherwise move on with his life.
The team doesn't really gain anything out of it other than the roster spot, but it would be a clean break along the lines of what the Mets did with David Wright.
A buyout doesn't solve the AAV problem that is used in the luxury tax calculation. Also, the roster spot is a non-issue, as he will go on the 60-day DL. If there was an offseason roster crunch on the 40-man, they could always designate him for assignment (which is essentially the buyout option).
The problem is not Pedroia's contract. The Sox knew all about his contract, and still failed to plan accordingly for 2020 when they extended Sale and resigned Eovaldi.
As for any side agreements regarding retirement for future coaching positions, don't expect that would fly at all for a number of reasons. If they tried that, I wouldn't be surprised if Manfred docked them a draft pick for attempting to circumvent the CBA. I assume the CBA has clauses in it that deliberate attempts at circumvention will be punished, and it's something that has happened in the NBA (Timberwolves) and NHL (Devils).
Maybe there would be nothing to easily prevent the Sox from saying to Pedey: "Why don't you wait 4 years, and we'll hire you as a coach for $25M over 5 years." But why would Pedroia agree to that? He's already seen 3 GM's either leave or get fired during his career. What happens if the team gets sold in the interim?