Jack might have been retrieving him because Kaido wanted to express his displeasure in person. The CP0 interaction was a major factor though and I would have expected Law to be more cautious. He got a bit too eager with his end game in sight.
But how far would that displeasure have gone? Kaido was arrogant but he wasn't delusional.
-When he thought there were rebels at Kuri Castle he elected to obliterate it while he was in the area.
-He had Kid imprisoned at Kuri and recognized that Kid had Supreme King Haki; Kid didn't do shit until after had Luffy had gotten there and Raizo infiltrated so there was no reason for him to think his usual strategy of "break them until loyal" wouldn't work.
-He knew Orochi wasn't worth a shit and got rid of him once it became apparent his spy didn't have any worthwhile information (anything Oden learned at the final island) and that Big Mom was no longer in competition, but cooperation with him.
-Doflamingo was able to use his powers to bring a whole kingdom to heel overnight. His being at Wano act 3 would've
completely negated Tama's presence there because he could take control of
every Gifter (whether or not they were under Tama's influence) because they sucked even with their powers and sicced them on the raiding party. And
that might have made the Ice Oni an even bigger problem than they were.
And yes, Law's quest for vengeance made him an idiot. Had he actually been able to see the bigger picture (not Doflamingo as the endgame but Kaido's operation as the greater scheme of which Doffy was only a piece of) he might have thought it through a little more. Then again, Doflamingo was pretty much
the go-to guy for the black market, so Law probably thought Kaido was just a client that had more power than Doflamingo's op could deal with should things go sour, as opposed to the de-facto Lead Performer of the Animal Kingdom Pirates that he actually was.