Followup of @chris
Incase you, like me, have gotten the task to save a shop which has migrated their store completely wrong here's a functioning script which takes a categoryId and attempt to recreate the category url_rewrite from the category request path to magento's internal mapping of category id.
You can use this in combination with Magento\Catalog\...
If you simply want to try to backup and then restore your Magento 2 database to a new db you can use MySql commands from the DB host :
mysqldump -h localhost -uUSERNAME -pPASSWORD M2DBNAME > backup.db.sql
mysql -h localhost -uUSERNAME -pPASSWORD M2NEWDBNAME < backup.db.sql
You will then need to configure M2 to use M2NEWDBNAME
First thing I'd do is evaluate the site and find out what functionality your neighbor needs, and what of that is "custom". Then determine what extensions need to stay to achieve that functionality. I'd remove anything else that isn't necessary and clean up any lingering database tables.
For the theme, you can start over from ...