This switches to testing kstack_pages at runtime instead of at compile time as its thread0 which causes the issue hence its the kernel's kstack_size size not the one which the ZFS module compiled with which needs testing.
This is still just a validation check, it would be good if this could if kernel stack size could be configured on the fly via loader setting, but that's something for another day.