Problem/Motivation
\Drupal\Core\Field\WidgetBase::formSingleElement
only allows modules to alter the resulting form. This makes it impossible for themes to consistently make changes to the widget form.
The only workaround would be to recursively loop over every element in a form looking for the characteristics of a widget form, which may not even be possible.
An example of why this would be a common scenario would be the datelist widget - it add's a fieldset around the elements. It would be entirely reasonable for a theme to want to use the composite fieldset to make date fields look consistent with other form elements. This is not possible at the moment.
Not sure if this should be marked as a bug, as I expect it's a non-intentional regression from D&.
Proposed resolution
Pass the widget form alter onto themes as well as modules.
API changes
Themes would be able to implement hook_field_widget_form_alter()
and hook_field_widget_WIDGET_TYPE_form_alter()
.