Sphinx seems to use docutils.writers._base_html.HTMLTranslator.starttag to start off a tag, which has this signature:
def starttag(self, node, tagname, suffix='\n', empty=False, **attributes):
Apart from CSS classes, it doesn't seem to have any logic for picking up attributes from the node itself - you have to pass them in attributes. It seems like every place that calls starttag calls it with some custom classes where needed, and these are merged with any classes set in the node. Here's an example for literals from sphinx.writers.html.HTMLTranslator:
self.starttag(node, 'code', '', CLASS='docutils literal notranslate')
If you had previously done node['classes'].append('foo'), then the resulting HTML element would have class="foo docutils literal notranslate" - but