This doesn't appear to be a blockly bug, but rather a protection in the interpreter to prevent infinite loops. Without further details, I'm not clear which interpreter. Googling "Maximum execution iteration exceed", I see similar errors in PHP, Google's app script, and SaleForce's platform.
If was a JavaScript in the web environment, I'd suggest web workers, or otherwise break the iteration into a sequence of multiple loops, chained together via JavaScript's setTimeout(). I'm sure your platform has something similar.