Add optional messages to the unreachable macro.

Closes #18842.