How to define custom stages in local downstream pipeline

I am trying to create a local downstream pipeline, but am having issues with defining the stages in the downstream pipeline.

From my testing, it seems impossible to define any custom stages in the downstream pipeline. Is that correct, or is there a way around this issue?

The most basic files to reproduce the issue looks like this:

.gitlab-ci.yml

run_dummy:
  trigger:
    include:
      - local: '/gitlab-pipelines/child_pipeline.yml'
    
    strategy: depend

/gitlab-pipelines/child_pipeline.yml that doesn’t work

stages:
  - build

dummy_job:
  stage: build
  script:
    - echo 'This job should run'

/gitlab-pipelines/child_pipeline.yml that does work

dummy_job:
  stage: build
  script:
    - echo 'This job should run'

The only difference between the two files is the definition of the stages.

When using the child pipeline with stages defined I get this error:
image

We are running self-hosted gitlab version 14.7.2-ee