Fix reading back of provenance records by fixing self reference.
This is a manual cherry-pick of MR !46757 (merged) in the 22.0-mc20 branch.
The original MR description:
This may fix some problems reported in Jira ATEAM-782 by correcting the provenance records.