Why does this scalar function not raise an error?
Figured it out myself. I did not fully understand how the strict keyword works but the docs state:

RETURNS NULL ON NULL INPUT or STRICT indicates that the function always returns null whenever any of its arguments are null. If this parameter is specified, the function is not executed when there are null arguments; instead a null result is assumed automatically.