Upgrading to Strapi 5 sets DocumentIDs non-deterministically
### Node Version

18.20.3

### NPM/Yarn/PNPM Version

Yarn 1.22.22

### Strapi Version

5.7.0

### Operating System

Strapi Cloud

### Database

Strapi Cloud

### Javascript or Typescript

Javascript

### Reproduction URL

_No response_

### Bug Description

### What is the problem?

When upgrading from Strapi 4 to Strapi 5, I have run into multiple problems with the document id because of our environmental setup. Specifically

1. That document IDs are present in the configuration files, which breaks the [Config-Sync Plugin](https://market.strapi.io/plugins/strapi-plugin-config-sync). Ex: `admin-role.strapi-super-admin.json`

```
{
  "name": "Super Admin",
  "code": "strapi-super-admin",
  "description": "Super Admins can access and manage all features and settings.",
  "documentId": "xxxxxxxxxxxxxxxxxxxxxxxx",
  "permissions": [
    {
      "action": "plugin::content-manager.explorer.create",
      "actionParameters": {},
      "subject": "api::country.country",
      "properties": {
        "fields": [
          "name"
        ]
      },
      "conditions": [],
      "documentId": "yyyyyyyyyyyyyyyyyyyyyyy",
      "locale": null
    },
```

This is a problem because I have multiple devs with local environments, multiple staging environments, a beta environment, and a production environment. These files cannot be imported using the aforementioned plugin because they result in _functionally_ invalid foreign keys. This results in nothing being updated. Alternatively, these files cannot be exported, because they will cause a discrepancy in sync files and database in _other_ environments. I.e. If I click export, my other dev Alex will then have to click export, which means I will have to click it again, ad infinitum. 

2. The migrations to add the field are run _after_ user migrations, so my attempts to set the values deterministically result in an error message. 

```
const chalk = require("chalk");
const crypto = require("crypto");

	const tablesToUpdate = [
		{ success: false, name: "admin_permissions" },
		/* More tables */
	];

module.exports = {
	up: async(knex) => {
		for(const table of tablesToUpdate) {
			const rows = await knex(table.name).select('id');

			// Update each row with the new document_id
			for (const row of rows) {
				const hashable = `${table.name}_${row.id.toString()}`;
                                // Create a documentId deterministically
				const documentId = crypto.createHash('md5').update(hashable).digest('hex').substr(0, 24);

				await knex(table.name)
					.where({ id: row.id })
					.update({ document_id: documentId });

				table.success = true;
			}
		}

		if(x = tablesToUpdate.find(x => !x.success)) {
			console.error(chalk.red("The update operation failed:"));
			throw new Error(x);
		}
	},
}
```

This results in the following error:

![Image](https://github.com/user-attachments/assets/46537d69-5829-44b8-b09f-e4b2734c6567)

Basically I need to commit and deploy this migration _after_ the v5 upgrade has completed.

### Proposed solution

1. Document IDs appear to be random. Update the migration that adds them to set them deterministically. 
2. Change the ordering of the migration executions such that system migrations (i.e. those associated with upgrading from v4 to v5) are run BEFORE any user migrations. 



### Steps to Reproduce

### Document IDs differ between environments.
1. Create a strapi v4 environment
2. Install the [Config-Sync Plugin](https://market.strapi.io/plugins/strapi-plugin-config-sync).
3. Commit the environment and deploy it elsewhere. 
4. Upgrade the environment from v4 to v5.
5. Use the plugin to export the changes in the admin tool, commit them. 
6. Pull the changes into the second environment, and attempt to run import in the admin tool. 
7. Document IDs in the file `admin-role.strapi-super-admin.json` will differ in the first and the second environment.

### Migration order favors user migrations
1. Create a strapi v4 environment complete with database and confirm that it is running.
2. Create a migration pertaining to document IDs. (see description)
3. Upgrate the v4 environment to a v5 environment. 
4. The migration will fail because document IDs "don't exist" because the user migration is run first. 

### Expected Behavior

### Document IDs differ between environments
Document IDs should be _consistent_ between environments, i.e. set deterministically.

### Migration order favors user migrations
Migrations pertaining to the underlying system (i.e. upgrading from strapi 4 to 5) should be run _before_ user migrations. 

### Logs

```shell

```

### Code Snippets

_No response_

### Media

_No response_

### Additional information

_No response_

### Confirmation Checklist

- [x] I have checked the existing [issues](https://github.com/strapi/strapi/issues) for duplicates.
- [x] I agree to follow this project's [Code of Conduct](https://github.com/strapi/strapi/blob/develop/CODE_OF_CONDUCT.md).