Job rules on change add the wrong job to pipeline

Hi everyone, I am facing issues with my setup. Seeking for help, thanks in advance

Problem to solve

Describe your question in as much detail as possible:
First push to the branch adds an incorrect job to the pipelines. Jobs have rules based on changesets

Job1 is triggered on the first push, instead of job2, the next commits to the same branch do work as intended. See steps to reproduce.

Steps to reproduce

git checkout anyOldCommitInMainBranch
git checkout -b hotfix/myFix

Make dummy change outside of folder1 or folder2. I am just modifying README.md in the repo root

git push origin hotfix/myFix

everytime I follow these steps, the first(initial push) triggers job1, any subsequent pushes to the same branch will trigger job2(which I expect to run always, when no changes done to folder1 or fodler2)

Troubleshooting steps
Tested several different configurations without luck, git diff from jobs show no diff in folder1 or folder2. No luck

Configuration

.on-merge: &on-merge
  if: $CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"
.on-hotfix-branch: &on-hotfix-branch
  if: $CI_COMMIT_BRANCH =~ /^hotfix\/.*$/ && $CI_PIPELINE_SOURCE == "push"

job1:
  stage: build
  resource_group: build
  extends:
    - .job1
  rules:
    - <<: *on-merge
      changes:
        - folder1/**/*
        - folder2/**/*
    - <<: *on-hotfix-branch
      changes:
        - folder1/**/*
        - folder2/**/*
    - when: never

job2:
  stage: build
  resource_group: build
  extends:
    - .job2
  rules:
    - <<: *on-merge
      changes:
        - folder1/**/*
        - folder2/**/*
      when: never
    - <<: *on-hotfix-branch
      changes:
        - folder1/**/*
        - folder2/**/*
      when: never
    - <<: *on-merge
    - <<: *on-hotfix-branch

Versions

Please select whether options apply, and add the version information.

  • [*] Self-managed
  • [*] Self-hosted Runners

Versions

  • GitLab Runner, 16.11.0 kubernetes amd64/linux

Probably found the answer:
https://docs.gitlab.com/ee/ci/yaml/#ruleschanges

For new branch pipelines or when there is no Git push event, rules: changes always evaluates to true and the job always runs. Pipelines like tag pipelines, scheduled pipelines, and manual pipelines, all do not have a Git push event associated with them. To cover these cases, use rules: changes: compare_to to specify the branch to compare against the pipeline ref.

In addition there is a ticket to support variable expansion in changes: compare_to block:
https://gitlab.com/gitlab-org/gitlab/-/issues/369916