phases: gather the logic for phasesets update in a single method
This logic is duplicated around for no good reason, we gather it in a single
place.
The conditional is the new function are a bit weird as we about going to extend it soon.
# So GitLab doesn't think we're using tons of Perl*.t -linguist-detectable