Block plugin's render array values ending up in $variables['content'] instead of $variables I've got a bizarre issue where my the render array from my block plugin's build() method doesn't seem to be properly interpreted by the template. I've got the following setup.
function my_module_theme(){
  return [
    'block__my_module__user_header' =&gt; [
      'render element' =&gt; 'children', // also tried without this
      'variables' =&gt; [
        'tabs' =&gt; NULL,
        'user' =&gt; NULL,
      ],
    ],
  ]
}

and my block plugin class
public function build() {

  $render_array = [
    '#theme' =&gt; 'block__my_module__user_header',
    '#tabs' =&gt; $this-&gt;getTabs(), // returns an array of data to handled in twig
    '#cache' =&gt; [
      'contexts' =&gt; [
        'route',
        'user',
      ],
    ],
  ];

  if ($user = $this-&gt;getContextValue('user')) {
    $render_array['#cache']['tags'] = $user-&gt;getCacheTags();
    $render_array['#user'] = $user;
  }

  return $render_array;
}

But then, when I inspect the variables in theme_preprocess_block(), all of that render array information from build() is sitting in $variables['content']. Same in the actual twig template, and same result if I remove ['#cache'] from build(). I'd expect to be able to access {{ tabs }} directly, but instead the data is sitting in {{ content['#tabs'] }}. Aside from that inconvenience, it also means that any cache tags/contexts I try to set in build() don't end up in the actual render array so they're completely ignored, which is a problem because the &quot;tabs&quot; as rendered in twig are dependent on this context.
I'm completely perplexed, as the same pattern works fine for hook_theme/block plugins in some of my modules, but this issue crops up in other modules.
This is how block templates work, they render the variable content.
{{ content }}

Your code though is using a block template inside of a block, which doesn't make sense, because the block template is wrapped around the block by Drupal automatically. You probably want to build the inside of the block like a controller output by using a custom template not derived from a block template, which you do when you don't start the template name with block__.
See https://www.drupal.org/docs/theming-drupal/twig-in-drupal/create-custom-twig-templates-for-custom-module