How to pass variables to a theme template file from EntityAPIController::buildContent()
You can provide theme variables through properties, e.g.:

$buildContent['module_plugin_instance_' . $instance_id] = [
  '#theme' =&gt; 'module_plugin_instance',
  '#instance_id' =&gt; 'foo',
];