I deleted my project that was called Test (forgot to delete it when I was trying to replicate this bug) and then saved a project as Test, saved just fine.
TLDR; because of dependent relationships in the database.
We don't delete projects immediately, just mark them as deleted just in case the user deleted them accidentally and wants to recover them later.
When you save a project under the name of a previously deleted one, the latter gets deleted for good to make room for the new one. Since these deleted projects had either been remixed or added to collections before being deleted, the system could not delete them without first removing them from the collection they belonged to, or removing their reference(s) in the remix table.
I had just forgotten about these cases, so the system was trying to delete a project without first fixing these reference issues, and failed.