The problems seems to be caused by using this code prior to the above code
I changed this to
and the code now works
I'm not sure why this might be causing a problem. When you changed your glDrawElementsIndirect code to use the absolute address of the array rather than the indirect buffer, you caused the driver to fetch the draw parameters from client memory. This is not directly supported by the hardware and so the driver emulates this with independent draw calls and is therefore equivalent to a simple loop in the application (minus a small amount of driver overhead).
Off the top of my head, the only thing I can think of is that there's some state leak GPU side, but I would consider that very unlikely. To really debug this, we'll need a test case that reproduces the issue. Besides the code you've already posted, do you have anything you'd be willing to share?
I will see if I can produce it in a simpler program