Why does WP_DEBUG only work after wp_debug_mode() is called? [closed]

Just take a look at its source:

function wp_debug_mode() {
    if ( WP_DEBUG ) {
        error_reporting( E_ALL );

        if ( WP_DEBUG_DISPLAY )
            ini_set( 'display_errors', 1 );
        elseif ( null !== WP_DEBUG_DISPLAY )
            ini_set( 'display_errors', 0 );

        if ( WP_DEBUG_LOG ) {
            ini_set( 'log_errors', 1 );
            ini_set( 'error_log', WP_CONTENT_DIR . '/debug.log' );
        }
    } else {
        error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
    }
    if ( defined( 'XMLRPC_REQUEST' ) )
        ini_set( 'display_errors', 0 );
}

You don’t call that function yourself. It gets called by core in ~/wp-settings.php during runtime long before hooks like muplugins_loaded, plugins_loaded or after_setup_theme are available for you.

The only you’ll have to make sure is to add

defined( 'WP_DEBUG' ) or defined( 'WP_DEBUG', TRUE );

to you wp-config.php file.

error code: 523