I have seen that the minimum can be set, but then the next sub-block can get any size as soon as it detects a midi event, even odd blocks.
I wonder if there is a problem forcing the midi iterator for the block to be divisible by some number. In my tests it works fine to modify the processNextBlock function, but I am not sure that on some hosts or hardware the divisible size of the buffers is less than 8 or 16, or some other type of problem may arise.
the modification is this, just subtract the module
const int samplesToNextMidiMessage = (metadata.samplePosition - startSample) - ((metadata.samplePosition - startSample) % div);