The problem here is that the grading code in modules uses grade item with itemnumber==0 for storage of grades. It is hardcoded in calls to grade_update(). It guarantees that it gets updates the same grade_item each time. It will also significantly simplify the migration of original gradebook data because the conversion of grade items is done during the main upgrade phase, the grades_items will be updated and actual grades send to new gradebook in the module upgrade.php script.
The problem could appear if we first manually create grade_item for assignment that does not yet have associated grade_item with itemnumber==0 (means assignment not graded). But then teacher enables grading.
I am not sure how to solve it, either we could define some ranges of itemnumbers 0..1000 for automatically created grade_items, 1001...2000 for imports and manual grading. And do the autoincrementing only in the manual/import range only.
Or we could always require the itemnumber and remove the autogeneration completely.