The gradebook API offers the use of itemnumber for when an activity has multiple graded items in a single instance. My understanding is that this has to be a unique ID, like one from a table used by the activity module. On restore though, this value is not relinked, but rather stays set to the original value in the backup file. Using a non-unique ID is not an option as backups could conflict when being restored to another site.
The solution that first came to mind is to write up a new restore method hook that is stored in mod/modname/restorelib.php that has the sole purpose of relinking this ID to a new one.