Composer vendor directory not found
Moodle can use Composer to install some dependencies, and checks whether these dependencies have been installed.
Moodle 5.1 added this check, but a Moodle 5.1 site doesn't need any libraries from Composer. From Moodle 5.2, Composer can install the third-party libraries that Moodle uses. Moodle still includes its own copies of these libraries, so Composer is optional until Moodle 6.0, except for new features such as OAuth 2 Server in Moodle 5.3. If you don't use these features, you can continue the upgrade without installing the dependencies.
This error message indicates that the dependencies have not been correctly installed.
To correctly install these dependencies you should run the following command from your Moodle root directory:
composer install --no-dev --classmap-authoritative
If you use Composer, run this command every time you upgrade Moodle.
See the Composer documentation for how to install Composer.