In your Medias Plugin class, do you have a bootstrap method? My initial guess is that you have to call parent.
class Plugin extends BasePlugin
{
/**
* Load all the plugin configuration and bootstrap logic.
*
* The host application is provided as an argument. This allows you to load
* additional plugin dependencies, or attach events.
*
* @param \Cake\Core\PluginApplicationInterface $app The host application
* @return void
*/
public function bootstrap(PluginApplicationInterface $app): void
{
parent::bootstrap($app); // call parent
Configure::write('image_types', ['image/png', 'image/jpeg', 'image/gif']);
}
....
Since moving/upgrading to CakePHP v4.x I have avoided the bootstrap.php & routes.php files and handled everything via the Plugin class and loaded specific configuration files.