And... I finally got around to looking into this. Got busy trying to mod another game (so I could play it in somewhat sane manner), and boy... That one is not as easy to mod as Factorio, I can tell you that :) (also, XML for scripting language... shiver...)
Anyway, I was able to easily reproduce this locally, and I know at least at which line in the code this happens, but I still don't quite know why. However... Having a hunch that this was not the issue before, I tried out a couple of different versions of Factorio, so I think there was some breaking (or fixing...) change introduced in Factorio mod API at some point. But at least I can now go ahead and have a bit of a look at version history to see if anything stands out :)
Best regards,
Branko