This was a battle to avenge Oden and liberate Wano, where all the minks and samurai came together to participate. Was Luffy supposed to just chuck her off his ship before the raid? They had no choice but to bring her along, because this was by extension her fight too.
The issue is that as soon as she branched from the crew, she goes against the man she perceived as Pedro's killer. And loses nearly getting herself killed. Only to get bailed by Neko, and makes no attempt to rejoin the fight.
This is different going forward because the enemies going forward are going to be grand in size and much stronger. What does Carrot have to beat an titanic captain? What does she have to deal with a vice admiral or even a commodore? Perospero more or less scales with these guys and she got her butt whopped in a 2v1. It's too much for her and Luffy would know that.
This isn't kid stuff anymore. This is endgame.