Merge pull request #33019 from ssiyad/fix/mutate_iter_list

fix: use `list()` on self mutating iteration