Found this in Drupal 7 but it looks similar in 8.x as well.
In views preprocess hooks, there's an empty $attributes_array variable. Adding anything to this doesn't do anything because it's not printed in the template.
<?php
/**
* @file
* Default simple view template to display a list of rows.
*
* @ingroup views_templates
*/
?>
<?php if (!empty($title)): ?>
<h3><?php print $title; ?></h3>
<?php endif; ?>
<?php foreach ($rows as $id => $row): ?>
<div <?php print $row_classes[$id]; ?>>
<?php print $row; ?>
</div>
<?php endforeach; ?>
The only way to get custom attributes is to override the template and do your own handling in preprocess.