What's even more unpleasant is that when you rebuild and don't lock it in - it turns out that you pay for nothing, just for the possibility to continue rebuilding
It seems like the old rebuilding was times more profitable, or am I misunderstanding something
In terms of the cost of digging up DD/TP, research is no different from rebuilding (TP is even cheaper, as you don't need to build MG5, plus you can research in parallel with construction, specifically, as Lizard wrote, on the day the MG is built). But during research, you won't get intermediate spells into your book, only the final TP/DD itself (and what was there at the beginning).
In the case of TP, however, you can lock some berserk and continue research in the second slot. Same with the library in the Tower. But it will be impossible to learn all the game's spells with a single MG.