Uncaught Error: Call to undefined function wp_kses() with PHP 8.3.6

I migrated my WordPress (multisite) website from PHP 7.4 to PHP 8.3.6 and got the following error:

Fatal error: Uncaught Error: Call to undefined function wp_kses() in /home/devnote/www/wp-includes/functions.php:6073 
Stack trace:
#0 /home/devnote/www/wp-includes/functions.php(5554): wp_trigger_error()
#1 /home/devnote/www/wp-includes/class-wpdb.php(1333): _deprecated_function()
#2 /home/devnote/www/wp-content/sunrise.php(11): wpdb->escape()
#3 /home/devnote/www/wp-includes/ms-settings.php(47): include_once('...')
#4 /home/devnote/www/wp-settings.php(155): require('...')
#5 /home/devnote/www/wp-config.php(107): require_once('...')
#6 /home/devnote/www/wp-load.php(50): require_once('...')
#7 /home/devnote/www/wp-blog-header.php(13): require_once('...')
#8 /home/devnote/www/index.php(17): require('...')
#9 {main} thrown in /home/devnote/www/wp-includes/functions.php on line 6073

./wp-includes/functions.php:

$message = wp_kses(
    $message,
    array(
            'a'      => array( 'href' => true ),
            'br'     => array(),
            'code'   => array(),
            'em'     => array(),
            'strong' => array(),
    ),
    array( 'http', 'https' )
);

I disabled the plugins and changed the theme, see here for details, but it did not help.