core: fix race condition where resource is deleted while also being pivoted.