A good comparison for Kim would be Oliver Twist. Both are orphans, both are poor, both are at the mercy of a greater world. However, Oliver was always being led around and had no sense or cunning where Kim, though small, is smart, observant, charming, and quick.
Kipling is just a better novelist than Dickens. In the scene with the cobra, Kim is taught his first lesson and Kipling writes the transition well.