Yay! Er, well, yes, I get that. I'm quite content with what is is. I was more interested in knowing if the cause (in the OP's case) was the notifyNeighborsOfStateChange call. As @Matryoshika has got it working to his satisfaction now, I'll happily move on.
I could be reading it wrong (and I'd appreciate the correction if I am), but I am suspicious that the cascading generation is happening when your right on the edge of the generated chunk. While you're checking that the BlockPos is within the selected chunk, the call to world.setBlockState subsequently does a notifyNeighborsOfStateChange which prods at the six blocks surrounding your selected BlockPos. If you're right on the edge, one of the adjacent blocks horizontally will be in the next chunk. At least, that's my take as somebody who is pretty new at this. If it turns out I'm way off-base, I should probably go back to lurking.