McDonagh's play defensively hasn't dropped off yet and the contract Tampa Bay gave him has worked out, they've won two Cups. And if his defensive play continues, then he'll be one of the rare exceptions where one of those long-term contracts to late 20s / early 30s players who aren't HHOF-bound end up working. Also worth noting, defensemen who are very competent defensively can extend their careers even if they lose their offensive production; The same can't be said for forwards.
However, his offensive production has definitely dropped; He used to be a perennial 35-40 point d-man in New Yawk and he's had three straight ~20 point seasons in Tampa Bay. When you're on an offensive juggernaut like Tampa Bay, losing some of the offensive production you have isn't the end of the world, especially if you can compensate defensively. But on most teams, that starts to become a burden where you're paying $6.75M for a guy who doesn't bring much to the table offensively.
Also, as mentioned, we got more production from our McDonagh alone than New Yawk got for McDonagh + JT Miller. I understood why McDonagh was traded on the Rangers's end, he was a Pending UFA and they didn't want to give him a long-term contract in the middle of a rebuild.