Hmm. The docs are a bit confusing, but this suggests that you need to define the variables in the parent .gitlab-ci.yml where the child pipeline is triggered:
When you define variables in UI you define them for parent pipeline only. As @snim2 pointed out you have to pass the variables to child pipeline. Child pipeline is considered as another pipeline and it does not inherit things from ‘parent’ pipeline automatically.
You should also look at GitLab CI/CD variables | GitLab. Variables passed to child pipelines are currently 5th - Inherited variables.