It's impossible to write a Kindlet that does what you want.
For writing a "normal" Kindlet, you'd first need an official developer account with Amazon, which many of the people in the dev corner applied for, and nobody ever even heard back from Amazon. And even so, if you stick with the "normally available" functionality, the kindlet is jailed, so that it can't determine whether the device is rooted/jailbroken.
A Kindlet which does what you want is of course possible to write, but in order to even get it to run, you MUST jailbreak the Kindle and install a couple of prerequisites. At which point the Kindlet itself is useless, because you'll KNOW that your device is jailbroken, before you're even running it.
A better approach is to try and install any of the unofficial packages available here - if the installation succeeds, the device is jailbroken, if it fails with error 007, it is not.