Magento can be installed using composer or you can also clone the Magento repository.
When using composer, a vendor folder is created (this is not specific to Magento in fact). Now, the content of the vendor folder is directly linked to the file composer.json at the root of your Magento install.
If you change any core code in the vendor folder by mistake, you can delete the entire folder vendor and run composer install, it will recreate the same codebase and your site will work like before.
However, if you do overwrite the vendor code, you do compromise all this, and needless to say your environment is a lot less robust.