Fixed updated layer's old metadata removal after changes for #90065.