Fatal Error in App\\Console\\Installer::postInstall

I decided to dispatch some shells from the Installer::postInstall function,

$bakeDatabaseConfig = $io->askAndValidate(
        '<info>Bake Database Config ? (Default to Y)</info> [<comment>Y,n</comment>]? ',
        $validator,
        10,
        'Y'
    );

    $shell = new ShellDispatcher();

    if (in_array($bakeDatabaseConfig, ['Y', 'y'])) {

        // cake bake database
        $shell->dispatch([
            'command' => 'bake database',
            'extra' => []
        ]);

however, I am getting a fatal error…

Fatal error: Call to undefined function Cake\Console\namespaceSplit() ... Console/Shell.php on line 174

It seems that the autoloader isn’t loading the files specified in composer.json when using

composer run-script post-install-cmd

Anyone know if I can use ShellDispatcher from the Installer.php in the App\src\Console?

… censored for your benefit …

from what I can tell, all I had to do is add

require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../../config/bootstrap.php');

to Installer.php, however, I just dont understand why I would have to do that in Installer.php … =]