I found this piece of code that is a bit different from yours. It’s supposed to be compatible with the latest version of WordPress. Your plugin works fine, but I was wondering if this would add something to your plugin. It seems that WP 6 adds CSS for a theme.
remove_action( 'wp_enqueue_scripts', 'wp_enqueue_global_styles' );
remove_action( 'wp_footer', 'wp_enqueue_global_styles', 1 );
remove_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
add_action( 'wp_enqueue_scripts', function() {
wp_dequeue_style( 'wp-block-library' );
wp_dequeue_style( 'wp-block-library-theme' );
wp_dequeue_style( 'classic-theme-styles' );
} );
add_filter( 'should_load_separate_core_block_assets', '__return_true' );
]]>
To disable the inline global style just activate the plugin. Nothing else.
To check if it works: