There's a lot of reasons Realmuto's production could crater over the next 3 years. On opening day he'll be a 35 year old catcher who has logged a metric ton of innings behind the plate in his career. He's never really been protected by getting time at 1B or DH. His speed and power have dropped in recent years. Etc...
That said, he's put up 2.0, 2.0, and 2.1 fWAR in the last three years -- including one season where he only logged 99 games. Before that, he was routinely putting up 4-6 win seasons.
With a little health, a solid sub, and a marginal return to form he could put up a single season that's worth near that whole $45 mil. And even if he doesn't $45 mil isn't what it used to be in this game. He's probably worth nearly that with something approximating standard age-related decline. I think it's a reasonably solid risk, and for a team like the Phillies seeing their window of contention closing -- it's a risk they absolutely had to take.