I mean, yeah, it is dumb. But I think the idea is that the bad guys are defeated by the people they’ve used and abused. Rey healing the serpent inspired BB-8 to give some of his energy to D-O, and that act of kindness gave the heroes an unexpected advantage.
Honestly, I’d love to see someone replace D-O’s human (JJ Abrams) voice with some glitchy beeps and boops like a normal astromech droid would make. Especially when the droid just says stuff like, “sad” and “happy”. It’s not endearing.