Fix undo/redo not restoring clean state.
Only set image as modified if the undo index is not in the clean state.
BUG:402263