uid of processed file is sometimes updated during processing
After a file is being (re)processed, the information about it is stored in the database again. This is done by the ProcessedFileRepository. The repository gathers information for the update from the processed file.
For files that are not changed (i.e. used as they are), the ProcessedFile class does a fallback to the original file object. Unfortunately, this uses the uid of the original file, as the ProcessedFile class does also do the fallback here. This leads to some random (well, not really random) record in sys_file_processedfile being overwritten with the information of the processed file.
The fix is quite simple: The processed file class should never return the uid of the original file, but always its own one if it has been persisted before, otherwise simply NULL.