Using hook_preprocess_views_view_unformatted properly
I tested your code locally and the way you are adding the class did work for me. E.g.
function mymodule_preprocess_views_view_unformatted(&amp;$variables) {
  $rows = $variables['rows'];

  foreach ($rows as $id =&gt; $row) {
    $variables['rows'][$id]['attributes']-&gt;addClass(['test-123', 'test-abc']);
  }
}

... worked fine for me. I'd say your var_dump() is not giving you the full picture.
Try this instead:
var_dump($variables['rows'][0]['attributes']-&gt;__toString());

When I var dump with toString() - I see the class indicated in the output - hopefully you will too
/var/www/mysite/docroot/modules/custom/my_module/my_module.module:149:string ' class=&quot;card test-123 test-abc&quot;' (length=31)