The problem also occurs with Symfony 7.
The solution is to install the
apache-pack https://packagist.org/packages/symfony/apache-pack
from Symfony.
It adds an .htaccess file to the public directory, which then takes over the redirects for the profiler paths. You can also use the dynamic asset mapping of the AssetMapper without having to compile the assets with it. Of course, this should only be used in the dev system.