The issue that we don't want before/after handlers to be executed when using this helper for when recursing to render a custom 500 error

I'm open to alternatives, and maybe breaking up this function might help avoid the need to recurse and have these flags that change behavior.