Dynamic child pipeline only executes first job

I have a yml that creates and triggers a child yml with several jobs, however, only the fist job actually gets executed and I have no clue why. Below is a minmal example that results in job-0 being executed and job-1 and job-2 ignored

.gitlab-ci.yml

stages:

  • child-pipeline-generator
  • child-pipeline-trigger

generate-child-pipeline:
stage: child-pipeline-generator
tags:
- yourRunner
script:
- $(./generate-child-pipeline.ps1) *>&1 > child-pipeline-gitlab-ci.yml
- (Get-Content child-pipeline-gitlab-ci.yml) | Set-Content child-pipeline-gitlab-ci.yml -Encoding UTF8
- Get-Content child-pipeline-gitlab-ci.yml
artifacts:
paths:
- child-pipeline-gitlab-ci.yml

trigger-child-pipeline:
stage: child-pipeline-trigger
trigger:
include:
- artifact: child-pipeline-gitlab-ci.yml
job: generate-child-pipeline

generate-child-pipeline.ps1

for ($i=0; $i -lt 3; $i++){
echo "job-$($i):
tags:
- yourRunner
script:
- echo $i
";
}

child-pipeline-gitlab-ci.yml

job-0:
tags:
- yourRunner
script:
- echo 0

job-1:
tags:
- yourRunner
script:
- echo 1

job-2:
tags:
- yourRunner
script:
- echo 2