Multiple includes force the user to define the stages manually

Summary

Whenever multiple templates are define in a gitlab-ci.yml file, only the last one has its staging properly set.

Steps to reproduce

<!-- main gitlab-ci.yml file -->

include:
  - project: 'my-group/my-project'
    file: 'test1.yml'
  - project: 'my-group/my-project'
    file: 'test2.yml'
<!-- test1.yml file -->

stages:
 - test_stage1

test_stage1:
 stage: test_stage1
 script: //some script
<!-- test2.yml file -->

stages:
 - test_stage2

test_stage2:
 stage: test_stage2
 script: //some script

What is the current bug behavior?

This GitLab CI configuration is invalid: test_stage job: stage parameter should be test_stage2

What is the expected correct behavior?

Stages should be working when multiple templates are including.

Relevant logs and/or screenshots

All credits go to this post on Stackoverflow for the examples : https://stackoverflow.com/questions/61234182/gitlab-ci-forces-me-to-define-stages-when-using-multiple-include

Output of checks

This bug happens on GitLab.com