Alright, so after a lot more playing in the code, I think I better understand what the mod is trying to do. Please disregard most of the post above.
I now understand why the code was trying to intervene with the crafting process. It was attempting to simulate a random grow time. An issue with the way the code was handling this, though, is that assemblers (the planters) consume their needed ingredients from the input slot when it starts a craft, so any attempt to entity.remove_item is going to affect whatever is standing by in the input for the next craft cycle. Couple this with the fact that setting craft progress manually to 0.0 would delete the consumed item, and now you're consuming 2 grow bags per grow cycle in the planter.
There was also another bug related to the actual saplings growing that was preventing saplings from ever maturing.
I have these new recommendations instead after my latest bout though the code:
1) Comment out or remove line 31. By resetting the crafting progress to 0.0, it resets the craft, deleting the item it was consuming without giving an output. There's no need to then also manually remove an item from the input as this will actually remove the next item queued up, not the one that was being used on the current craft.
2) Change line 141 to:
if item.entity.crafting_progress > 0.0 then
And subsequently change line 148 to:
if item.entity.crafting_progress == 0.0 then
This changes the presence of the tree in the planter from grow bag count to craft progress, and solves manually removing extra grow bags in the planter causing the crafting process to cancel. It also solves another bug where a planter with only 1 grow bag (the one it's currently consuming) never has a tree show (though there is the slight side affect that you'll never see the tree actually disappear if there is another grow bag standing by. This can be fixed by changing 0.0 to something like 0.01 (1%), though the == 0.0 would need to be < 0.01, and > 0 should be >= 0.01).
3) Comment out or remove line 209:
item.entity.crafting_progress = 0.0
It's not needed. With the change to line 148, this should only trigger when crafting_progress is already 0.0.
4) Comment out or remove lines 220, 221, & 223. Change line 222 to:
item.planter.entity.crafting_progress = 1.0
By setting progress to 100% (instead of 0) you kick the planter into finishing the craft for you and the rest in completely unneeded. Has the added benefit of it outputting the actual recipe result, in the event you or another mod make a future change, without also having to update the control script code.
5) Line 161, change the or condition to and. This was preventing the saplings from ever actually maturing, even when planted manually.
6) Change game.surfaces[1] on lines 142 & 231 to instead item.entity.surface and item.planter.entity.surface, respectively. This will support making the mod multi-surface friendly. There are a couple more instances in the ConfigChanged function, but these are fine being left as is due to them being for migration from other mod versions.
7) In addition to the unused function allow_productivity_if_needed at line 70, I also found another unused function right next to it at line 60, table_contains (only used in the allow_productivity_if_needed function).
8) The math for determining sapling grow time:
local randnumber = math.random() * 4 - 2
math.floor(1800 * ((randnumber ^ 3) + randnumber + 12))
Can be simplified into one formula that's less complex:
math.floor(((math.random() * 10) + 1) * 3600)
Or even:
math.floor((math.random() * 36000) + 3600)
These achieve the same result, just the first recommended one is easier to see (and understand) what the upper and lower bounds are in minutes (1 to 11). Though I may suggest upping the lower bound, and maybe lowering the upper. In a personal edit, I have 4 & 4 in place of the 10 & 1 values, making it 4 to 8 minutes (same average of 6 minutes).
9) The "grow-sapling" recipe's energy_required should probably be set to being longer than the upper bound of the grow time by at least 1-2 seconds. Benefit of the planters is they automatically harvest the tree when ready. Otherwise, what's the point in all the manual intervening in the craft time of the planter? (If for recommendation #2 you use something other than 0.0, you may want to adjust the buffer here by an appropriate amount as 1% of 11 minutes is 6.6 seconds.)
10) I'd also recommend either getting rid of the grow bags, or getting rid of the sapling item (and their related recipes). (If getting rid of the sapling, merely move the grow bag to the first tech and give it the place_result of the sapling, and the sapling entity's mining result needs to be the grow bag, and of course change the grow bag's ingredients). It makes sense for the sapling to require fertilizer, and it makes sense for the grow bag to need fertilizer, but it doesn't make sense to use fertilizer twice. This would cut the cost requirements in half (which I think was already steep needing 60 raw petrol for 1 fertilizer (I've made a personal edit that uses 15+15 (30 raw petrol) to 5 fertilizer (with adjusted craft time to match) making it 6 raw petrol to 1 fertilizer)) and eliminate 1 assembling step (and the associated pollution from both).