This looks like the same issue as Duplicate key error during pulpcore.app.tasks.repository.add_and_remove · Issue #2047 · pulp/pulpcore · GitHub - a few users have run into it but has been an incredible pain to actually reproduce and create a test case for. It seems like some kind of timing bug perhaps?
Time to bump the priority again.