Troubleshooting require_once error (on Composer + WordPress Plugin)

I’ve developed a WordPress Plugin using Composer as Dependency Manager (I’m not a php dev, hope this is the correct naming). When trying to activate the plugin I was getting errors about require_once not finding files.

Warning: require(/home/251650.cloudwaysapps.com/geytjjwugd/public_html/wp-content/plugins/gik25-microdata/vendor/composer/../phpunit/phpunit/src/Framework/Assert/Functions.php): failed to open stream: No such file or directory in /home/251650.cloudwaysapps.com/geytjjwugd/public_html/wp-content/plugins/gik25-microdata/vendor/composer/autoload_real.php on line 55

Fatal error: require(): Failed opening required '/home/geytjjwugd/public_html/wp-content/plugins/gik25-microdata/vendor/composer/../phpunit/phpunit/src/Framework/Assert/Functions.php' (include_path='.:/usr/share/php') in /home/geytjjwugd/public_html/wp-content/plugins/gik25-microdata/vendor/composer/autoload_real.php on line 55

I tried to debug it through my (low) PHP skills (the file was there), I tried to reset the file permission and, last attempt, I tried to execute Composer direclty through SSH. It worked and I’d like to understand HOW!

Doing php composer.phar update after cleaning the vendor folder resulted in the deletion of many subfolders.

enter image description here

May unused folder in vendor have any relation with autoloading not working?

I also removed Phpunit 10 from the composer.json file BEFORE running composer update and it didn’t solve my issue until I did the composer update.

enter image description here

I see the buggest change in composer.lock file. 1500 lines disappeared.

But the changes don’t relate to PHP code, how can they broke the PHP execution? There is no change in the autoload.php.