How to output from custom module without rest of theme
The controller does not have to return a render array, it can also provide a symphony response, for example:

use Symfony\Component\HttpFoundation\Response;

$response = new Response();
$response-&gt;setContent('&lt;h1&gt;Hello world&lt;/h1&gt;');
//$response-&gt;headers-&gt;set('Content-Type', 'text/xml');
return $response;


This will bypass the Drupal rendering and theming.

Edit:

You can use two approaches to replace your Drupal 7 code:

1) Override page.html.twig and html.html.twig, remove anything out of this templates and put only that in what you want.

2) Render the HTML like you are doing it now in Drupal 7 and use a Symfony response.

Rendering in Drupal 8:

use Symfony\Component\HttpFoundation\Response;

$output = \Drupal::service('renderer')-&gt;renderRoot($build);

$response = new Response();
$response-&gt;setContent($output);

return $response;