Yes, an undertank heater controlled by a thermostat will provide better heating, it won't drive out the humidity the way a lamp does, and of course, you can't keep using an insecure lid.

And yes, ball pythons are inquisitive predators that will find any way out that they can. They're also strong, and they can and will injure themselves in the process of escaping through an opening which is too small, or has sharp edges.