__builtin_unreachable doesn't raise any compile-time warnings/errors on its own, so problems with its usage can't be easily detected. While it would be nice for this situation to change and compilers to at least add a warning for trivial cases where local state means the instruction can't be reached, this isn't the case at the moment.
Push __unreachable out of sys/cdefs.h for _KERNEL builds[*], making sys/systm.h a requirement for it in the kernel. We then turn it into a straight panic[**] under INVARIANTS, as the context will very likely not have taken into account what might happen if this happened.
[*] Alternate option here, I think, would be to *instead* provide a __kernel_unreachable and use that in the kernel instead of __unreachable, leaving sys/cdefs.h untouched. I opted not do so in this initial work so that out-of-tree stuff using __unreachable either breaks or gets the new behavior.
[**] I had also considered a kassert_panic, but I'm unsure -- a lot of the same things would apply to a KASSERT() apply here, but this is perhaps more likely to be used in scenarios where we really really won't do the right thing if it's reached.