This is not an overpay by any means. Cap is exploding next year by all reports. For comparison Deion Jones signed a 4 year 57 million dollar contract with 34 guaranteed in 2019. Baker was going to get this contract, and probably more if he hit free agency next year.
Baker's arrived guys. He had 112 tackles last year, 7 sacks, 2 forced fumbles, 7 more tackles in the backfield, and 11 QB hits. Oh and coverage? He let up 6.1 yards per attempt. A 25 year old linebacker with that kind of production going to get more than 13 million a year in next year's free agency.
He's also clearly gambling on himself with this contract. It expires when he is 28. Enough time left in his career to sign one more mega deal.