If the Pats had been confident that Bolden (or a random UDFA) could have provided what they thought Gillislee could, they'd have gone that way.
"... one of the richest contracts (the Pats) have ever given to an RB" was still less than 27 other RBs in the league are making - millions less than most of the guys above Rex (and Gillislee). I really don't see how he's "overpaid".
First of all, there really aren't guys like Hunt and Kamara in the mid-rounds "every draft". The 2017 class turned out to have been fairly strong, but even that's relative. There are 20-30 RBs drafted every year. Generally only a handful turn out to be really decent, and fewer still have the kind of rookie impact that Hunt and Kamara provided this season.
Secondly, the Pats have only a few draft picks to spend on developmental college prospects and future needs, and at more than just the RB position. Going into FA and the draft this past spring, the Pats had an aging (runner-only) Blount who was UFA, White (who's far more receiver than rusher), and Lewis (still trying to get back on track returning from his injury). So, they spent a 5th round pick on a guy with a few years of NFL experience, and signed another as a UFA. And they had to pay a bit more for that experience in order to get players who had a better chance of contributing immediately.
Between the two of them, Burkhead and Gillislee contributed 918 yards from scrimmage and 13 TDs for $6.35M. DeMarco Murray posted 925 yards from scrimmage and 7 TDs for $6.95M.
I'm still not seeing how the Pats "overpaid".