Existing code was intrisically wrong, and also potentially very innefficient. Now tagging objects for deletion and removal is separated from actual collection removal and object deletion. This makes the code safer, simpler and more efficient. NOTE: There is still an unsolved (already existing in original code) issue with checks on objects that should not be deleted, noted in code. Pull Request: https://projects.blender.org/blender/blender/pulls/106821