Add a class to a Drupal table cell containing ['data']
After writing out the question in general terms, I've gone back to test again, and have determined that Option 5 in the OP with '#wrapper_attributes' at the same level of the 'data' element does work.  I believe Drupal 8 was aggressively caching the table, because my changes were not showing up even after a drush cr.  

The rules for adding classes to tables via backend PHP is:


Table class requires #attributes.
TR row class inside TBODY requires #attributes.
TD cell class inside TBODY requires #wrapper_attributes.
TR row class inside THEAD/TFOOT requires 'class' and 'data' containers.  Neither #attributes nor #wrapper_attributes work here.
TH/TD cell class inside THEAD/TFOOT requires 'class' and 'data' containers.  Neither #attributes nor #wrapper_attributes work here. 
There is no way to add a class directly to a &lt;thead&gt; or &lt;tfoot&gt; tag without overriding a twig template.


Here is the most common example for adding classes to the &lt;tr&gt; &amp; &lt;td&gt; tags inside the main &lt;tbody&gt;, as well as to the main &lt;table&gt; tag itself:

$table = [
  '#type' =&gt; 'table',
  '#attributes' =&gt; [
    'class' =&gt; ['table-class'],
  ],
  'row1' =&gt; [
    '#attributes' =&gt; [
      'class' =&gt; ['tr-class'],
    ],
    // Table data cell using 'data' for renderable elements.
    'column1' =&gt; [
      'data' =&gt; [
        '#type' =&gt; 'link', // Or any other renderable thing.
        '#attributes' =&gt; [
          'class' =&gt; ['link-class'],
        ],
        // Other elements required to render the link go here...
      ],
      '#wrapper_attributes' =&gt; [ // Watch out!
        'class' =&gt; ['td-class'],
      ],
    ],
    // Table data cell using '#markup'.
    'column2' =&gt; [
      '#markup' =&gt; '&lt;span&gt;' . $this-&gt;t('text') . '&lt;/span&gt;',
      '#wrapper_attributes' =&gt; [   
        'class' =&gt; ['td-class'],
      ],
    ],
  ],
];


Note that the 'class' container will accept either a string or an array, but I suggest always using an array. 

From here, the story gets more complicated.  If you need to add classes to the TR or TD/TH tags inside a THEAD/TFOOT area, the rules change completely.  Neither #attributes nor #wrapper_attributes work inside #header and #footer sections and trying to use them produces very strange effects. 

The bare minimum structure for tables with header/footer data columns in Drupal 8 is this:

$table = [
  '#type' =&gt; 'table',
  // Produces &lt;thead&gt; &lt;tr&gt; &lt;th&gt;
  '#header' =&gt; [
    'Header 1',
    'Header 2',
    'Header 3',
  ],
  // Produces &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;
  'row1' =&gt; [
    'Body 1',
    'Body 2',
    'Body 3',
  ],
  // Produces &lt;tfoot&gt; &lt;tr&gt; &lt;td&gt;
  '#footer' =&gt; [
    'Footer 1',
    'Footer 2',
    'Footer 3',
  ],
];


You must change the actual structure of the data and introduce two levels of additional multi-dimensional arrays, in order to leverage the 'class' array index which requires then also introducing the 'data' array index.  This applies both to the row element and the data cell elements, as seen in the following example:

$table = [
  '#type' =&gt; 'table',
  // This example works the same way for '#footer'.
  '#header' =&gt; [
    // First, introduce an extra level to the array to provide a
    // place to store the class attribute on the &lt;tr&gt; element inside
    // the &lt;thead&gt;.
    [
      'class' =&gt; 'thead-tr-class',
      // Next place the columns inside a 'data' container, so that
      // the 'class' can be used.  '#wrapper_attributes' will not
      // work here.
      'data' =&gt; [
        // The following line produces data inside a &lt;th&gt;
        // without any class.
        'Header 1',

        // The following lines produce data inside a &lt;th&gt;
        // with a class: th-class.
        [
           'class' =&gt; 'th-class',
           'data' =&gt; 'Header 2',
           'colspan' =&gt; 2
        ],
      ],
    ],
  ],
];


The above example #header example produces:

&lt;table&gt;
  &lt;thead&gt;
    &lt;tr class="thead-tr-class"&gt;
      &lt;th&gt;Header 1&lt;/th&gt;
      &lt;th class="th-class" colspan="2"&gt;Header 2&lt;/th&gt;
    &lt;/tr&gt;
  &lt;/thead&gt;
&lt;/table&gt;