Tried to do that too. Unfortunately the "on_entity_died" event in the API does not trigger when ghost is removed by placing an entity over it, so I have no way to detect it.
Latest update introduced a weapon to kill tunneling worms from a distance though, so now you have a way to fight back and prevent them from digging into the base.