Fix autoloading when installed as a dependency

Previously, when the project was installed as a dependency through
composer the `generate` script could not find the autoloader.

This commit resolves that by checking whether the autoloader exists in
the same directory as the project (i.e. not as a dependency) or whether
the autoloader exists two directories above (i.e. as a dependency). If
neither of these paths exist, the script will gracefully fail.