Doflamingo is a character written for adults. Oda even slightly alluded to this with the Viola comments. He was a Seinen character in a Shonen manga.
When he "resigned" from the Warlords, I thought to myself that he actually did it. He can't just fuck with the World Government like that. He doesn't have the authority. And then BAM, Oda revealed he was a Celestial Dragon. Everything with that plotline was masterfully played, including the Law stuff.