Kuzan never actually switched sides and Oda has been setting this up for years.....Hear me out
Personally, I feel like Kuzan being a double agent as a member of SWORD and infiltrating the Blackbeard pirates makes the most sense. Blackbeard has been going all across the seas becoming a bigger threat each time. It makes sense that this would trigger the Navy's attention and push for them to keep a close eye on him. Kuzan is a known protégé of Garp. We've seen throughout the entire series that Garp shares a lot of similarities with Luffy. Specifically, the trait that allows people to be inspired by WHO he is not by the power he wields. Garp's ideology is definitely the type that sticks with those that carry a moral backbone. Koby is the perfect example of this. Kuzan is another. The Elbaf reveal that Saul is still alive, and Kuzan's behavior at Hachinosu when Garp was captured, both suggest that whatever his arrangement with Blackbeard is, his loyalty was never really in question.