From your explanation, it sounds like you're expecting your RS2Object instance (from before depletion) to change ID, which it never will. You will have to grab the new RS2Object instance, as the depleted rock is generally speaking a new different object.
As an alternative to checking the depletion ID, you could check if your non-depleted object instance has stopped existing with the exists() method.