Gagliardini was reportedly 20m obligation + 2m loan fee + 6m in bonuses. Caldara was 15m + 6m in bonuses, so you're wrong there, 28 isn't 21.
Besides Caldara is bound to develop better at Atalanta compared to playing Coppa games together with Benatia, it's a sensible deal from Marotta, we don't exactly have space to develop promising CBs right now.
Defenders being less expensive than midfielders? It's a crap statement, ask Chelsea how many good and cheap Serie A defenders they were able to sign last summer. They reportedly offered figures like 40m-50m for Romagnoli and Koulibaly and got turned down, Caldara for 15+6m is a great deal.