dev/core#2039 Fix merge code so that deleted contacts are not left without a primary address
This was picked up in tests to ensure that removing a line of code creating excessing queries
would not cause regressions.
https://lab.civicrm.org/dev/core/-/issues/2039
I considered altering the test to exclude deleted contacts but we run the risk that if a contact
is undeleted they will have no primary address so I figured the integrity makes sense.
Note there are a couple of queries in this code that can go (retrieving stuff
we already have) - depending how I go on getting review on this & related tidy up I'll remove them
in a later PR