Cancelling the account move paying an invoice adds the cancelling line to the payment lines of the invoice
When canceling the paying move of an invoice a new move is created with a line canceling the paying line of the invoice. This line will be referenced in the payment lines of the invoice.
This is due to the fact that canceling an account move is basically duplicating the move with the credit / debit amount inverted. Thus in copy process the link to the invoice is also copied.
So we should not copy the link and remove the link of the canceled move.