How to filter customize_loaded_components from a theme?

Since WordPress 4.5, there is a new warning regarding the use of remove_panel with core components (at the moment 'nav_menus' and 'widgets').

The warning states:

Removing WP_Customize_Manager::remove_panel manually will cause PHP
warnings. Use the customize_loaded_components filter instead.

Apparently it was added because of some php and javascript errors that seemed to be occurring in WordPress releases from 4.0 to 4.5, when plugins and/or themes were giving contradictory orders, like one trying to modify the widgets panel after another had removed it before.

The warning suggestion, however, is not valid for themes, since customize_loaded_components is fired before them. So this hook called from a theme just won’t have place in the right moment of the processing queue and will have no effect.

For 'nav_menus' there is this workaround, which doesn’t seem to work for widgets:

$wp_customize->get_panel( 'nav_menus' )->active_callback = '__return_false';

There might be a method to remove the widgets panel effectively without the warning getting printed. But for a general, public usage, it just seems to be against the best practices to remove any of those core components from within a theme.

error code: 523