Fix #3936: Crash when deleting a selection containing both child primitive and parent entity