Cannot connect to database if using credentials from external source
### Node Version

22.12.0

### NPM/Yarn/PNPM Version

10.9.0

### Strapi Version

5.10.3

### Operating System

Linux (Debian/Ubuntu)

### Database

MySQL

### Javascript or Typescript

Javascript

### Reproduction URL

_No response_

### Bug Description

I've migrated my strapi cms project from 4.25 to 5.10, now i cannot make connection to database. Earlier it used to work fine but now it no longer works. My setup for establishing connection to db is explained as below :-

For local env i used to get credentials from env file itself but when the project goes on production server, i used to fetch credentials from aws secret manager inside `src/index.js` which provides an async function `register` that runs before app initialization. So there i used to set the connection fields to my db using `strapi.config.set('database.connection.connection')` but it no longer works. Below is the code that i had :-

config/database.js
```
module.exports = ({ env }) => {
  return {
    connection: {
      client: "mysql",
      connection: {
        ssl: {
          rejectUnauthorized: env.bool("DATABASE_SSL_SELF", false),
        }
      },
      debug: false,
    },
  };
};
```
src/index.js
```
"use strict";

const { getCredentials } = require("../config/functions/getCredentials");

module.exports = {
  /**
   * An asynchronous register function that runs before
   * your application is initialized.
   *
   * This gives you an opportunity to extend code.
   */
  async register({ strapi }) {
    if (process.env.ENVIRONMENT_TYPE === "LOCAL") {
      strapi.config.set(
        "database.connection.connection.host",
        process.env.DATABASE_HOST, // seems like this method no longer works
      );
      strapi.config.set(
        "database.connection.connection.port",
        process.env.DATABASE_PORT,
      );
      strapi.config.set(
        "database.connection.connection.database",
        process.env.DATABASE_NAME,
      );
      strapi.config.set(
        "database.connection.connection.user",
        process.env.DATABASE_USERNAME,
      );
      strapi.config.set(
        "database.connection.connection.password",
        process.env.DATABASE_PASSWORD,
      );
    } else {
      const credentials = await getCredentials(process.env.AWS_SECRET_NAME);
      strapi.config.set(
        "database.connection.connection.host",
        credentials.RDS_ENDPOINT,
      );
      strapi.config.set(
        "database.connection.connection.port",
        credentials.DB_PORT,
      );
      strapi.config.set(
        "database.connection.connection.database",
        credentials.DB_Name,
      );
      strapi.config.set(
        "database.connection.connection.user",
        credentials.DB_USER,
      );
      strapi.config.set(
        "database.connection.connection.password",
        credentials.DATABASE_PASSWORD,
      );
    }
  },

  /**
   * An asynchronous bootstrap function that runs before
   * your application gets started.
   *
   * This gives you an opportunity to set up your data model,
   * run jobs, or perform some special logic.
   */
  bootstrap(/*{ strapi }*/) {},
};
```
With the same configuration mentioned above, it used to work fine, but after upgrading to v5 it no longer works. Can someone please shed some light on this matter?

### Steps to Reproduce

1. create a new strapi project using `npx create-strapi@latest`
2. make the changes as i mentioned in `config/database.js` & `src/index.js`
3. run the project using `npm run dev`
4. same issue.

### Expected Behavior

Strapi should first fetch credentials from external source (in my case - aws secret manager) & then update the connection object through `index.js` `register` function using `strapi.config.set` method.

### Logs
server logs :-
```shell
Error: connect ECONNREFUSED 127.0.0.1:3306
at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1495:16)
[2025-03-06 07:38:16.536] info: Shutting down Strapi
```

### 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).