libcore: Make fail handlers optional

Some users would rather define their own fail handlers. One potential
application here is embedded users where the code size increase from
pulling in fmt is unacceptable. See #17886.