Why can html.twig files be placed outside the templates folder? In Drupal theme folder structure, there is written:

Templates provide HTML markup and some presentation logic. Contrary to Drupal 7, in Drupal 8 template files (*.html.twig files) must be stored in the 'templates' subfolder.

In my theme, I have a styleguide folder at the root. Drupal 9 finds template files, such as mytheme/styleguide/components/10-atoms/form/input.html.twig, in this folder.
Drupal 9 will use this input.html.twig file despite it's not in the mytheme/templates folder.
Ok, I have found a solution, I just need to add in my settings.php the &quot;styleguide&quot; folder in the ignore directories
$settings['file_scan_ignore_directories'] = [
  'node_modules',
  'bower_components',
  'styleguide'
];