Remove unnecessary db call when replacing.

When replacing a has_many association with the same one, there is no
need to do a round-trip to the db to create/and drop a new transaction.

[fixes #14220]
Merge pull request #14234 from arthurnn/fix_trans_on_replace

Remove unnecessary db call when replacing.