Factorio developer here (and the one who wrote the error lines you're seeing in the log file):
The reason the game crashes on saving and when changing the cursor stack is you're making an invalid state in the game. There are specific functions that are supposed to be called any time items are added or removed from inventories and item stacks. Not calling those functions leaves the game in an inconsistent state and other pieces of the code will continue operating as if the item(s) never changed because they never got the events for them changing. See:
[Link] (Invaraints are required)
Some items are never meant to have counts > 1 so just injecting "count = 50" on them leads to things like standard item transfer ending up completely broken which results in more crashing. See
[Link]
Some items have extra data associated with them which is created when a item stack is created through the correct process but injecting "the stack is now X item" skips that part and you get other crashes when the logic operates as if it was done correctly. See:
[Link] (Item stack optimization)
In the end, people will still mess around with the game and bypass these checks resulting in more crashing - but please - disable automatic crash reporting
(under Settings -> Other -> "Upload crash logs")