MDL-65313 core: Fix orphaned favourites cleanup