How to render a field of a taxonomy term inside a view template? I'm trying to display an image as a banner above the items of a view (which creates a block). The image is a field associated to a taxonomy term and the view is used to display all items which have this term. Is it possible to inject the image into the render array using a hook in order to access and render it on a specific location inside the view's template (for example block--views-block--example.html.twig)? I can't find a good solution anywhere on the web. I'm thinking of something like this (pseudo code):
function suitable_hook(&amp;$vars) {
  $image = getFieldOfTaxonomyTerm('taxonomy_term', 'image_field_name');
  $vars['associated_image'] = $image;
}

If there are better approaches to this problem in general, please let me know as well. Thanks a lot in advance for your suggestions!
This can be done entirely from within the Drupal UI.
If you already have access to the taxonomy term in the view, you can add the term entity directly.
This is what the core taxonomy term pages view does.
To see for yourself, go to /admin/structure/views/view/taxonomy_term on a standard Drupal 8/9 installation.
In the header, you will find Global rendered entity: Taxonomy term. If you click this to open up the settings, you will see that Drupal is loading the term based on the argument {{ raw_arguments.tid }}, which is provided by the Contextual Filter Content: Has term ID. (Check the settings there as well.)
For your own block, I would use this same technique.  You say you want to render the image, not necessarily the whole taxonomy term.  To do that, I would create a new View Mode for the term that only has the image and whatever else you want to display.
You can create a View Mode for a taxonomy term by going to the &quot;Manage Display&quot; page for the relevant taxonomy vocabulary.
Then, in Views, in the header where you are rendering the term entity, you can set the view mode to your new custom view mode.