MDL-47056 core_grades: Prevent items being displayed as 'Error'

Before this patch we would be marking some items as 'needsupdate'
during an update. Leaving them aside and not effectively updating
them.

Part of: MDL-46576
MDL-47256 gradebook: Fixed up split in upgrade script.

Part of: MDL-46576