Need to build a branch specific CI variable key in the .gitlab-ci.yml file that are already declared in the UI

Currently running version 16.5 of GitLab in a self hosted environment.
Say I want to execute a docker build command in the build task but I want to incorporate two different sets of build args, one at the project level and one at the branch level like so --build-arg PROJECT=my-project and --build-arg BRANCH=my-branch.
The CI variables’ keys will be configured via the UI as such PROJECT_LEVEL_BUILD_ARGS_COMMAND and each branch will have their own defined as such feature_branch_27_nov_BUILD_ARGS_COMMAND .
I don’t want to hard code the branch specific variable keys in the gitlab-ci.yml file, rather I’d like to build it. I know I can get the branch name from the Pre-defined variable $CI_COMMIT_BRANCH but how can I append the string BUILD_ARGS_COMMAND to the branch name and then use that string as the key to get the CI variable I defined in the CI?
The end docker build command will look like this docker build -t image:tag $BUILD_ARGS_COMMAND $BRANCH_SPECIFIC_BUILD_ARGS_COMMAND . I am also open to approaching this differently with the end goal being that users of our GitLab instance can use the same build task for building their docker images with project specific and branch specific build arguments.

I would still like to find a solution to this but at the moment the approach I am taking is the following:

    - if: $CI_COMMIT_REF_NAME == "feature/init"
        BRANCH_SPECIFIC_BUILD_ARGS_COMMAND: "--build-arg BRANCH=feature/init"
        BRANCH_SPECIFIC_ENV_VARS_OBJECT_STRING: '{"name":"branch","value":"feature/init"}'
    - when: always