WordPress core register a shutdown function on its own (source) the function shutdown_action_hook
registered to be ran on shutdown, call
do_action( 'shutdown' );
and little more (source).
So, if you want to register a shutdown function in WordPress way just add your function on ‘shutdown’ hook:
add_action( 'shutdown', 'my_shutdown_callback' );
function my_shutdown_callback() {
error_log('Goodbye');
}
Where to put this code is not very important, a plugin, a mu plugin, functions.php, it doesn’t matter, it will run always on shutdown…
Of course register it as soon as possible allows you to catch early errors, so using a mu plugin you can catch errors that happen on plugins init.