You can create variation for core block and modify the query arguments.
I use it on wp-performance.com. Exemple on this page end => https://wp-performance.com/snippet/desactiver-php-dans-les-repertoires-plugins-uploads-et-themes/
1 - Create variation block with javascript file => assets/block-variations.js
2 - Change query arguments with filter hook for this variation namespace => index.php