It seems assigning to a state and afterward deleting the thing will clear the state. Is it an option for you to give that thing a flag like ‘toBeDeleted’ or ‘archived’, assign it to a state but not to delete it until you finished the other logic you wish to perform? Logic, tables, repeating groups etc. can filter based on the flag and exclude the thing. Afterwards you can always permanently delete it.

Another option would be to save properties / field data from that thing to specific states, delete the thing and perform any actions using those states.