See https://github.com/ezsystems/ezpublish-kernel/blob/master/eZ/Bundle/EzPublishCoreBundle/Console/Application.php#L53-L58
This should be done in LegacyBundle
EZP-23868 Move getLegacyKernel() helper from CoreBundle controller to LegacyBundle
PR