Move _WidgetsInTemplateMixin specific code from _AttachMixin to _WidgetsInTemplateMixin.  Refs #16576 tangentially, !strict.