"include:rule should be a hash" seems invalid when using !reference tag for include:rules:
<!--IssueSummary start-->
<details>
<summary>
Everyone can contribute. [Help move this issue forward](https://handbook.gitlab.com/handbook/marketing/developer-relations/contributor-success/community-contributors-workflows/#contributor-links) while earning points, leveling up and collecting rewards.
</summary>
- [Close this issue](https://contributors.gitlab.com/manage-issue?action=close&projectId=278964&issueIid=434157)
</details>
<!--IssueSummary end-->
<!---
Please read this!
Before opening a new issue, make sure to search for keywords in the issues
filtered by the "regression" or "type::bug" label:
- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=regression
- https://gitlab.com/gitlab-org/gitlab/issues?label_name%5B%5D=type::bug
and verify the issue you're about to submit isn't a duplicate.
--->
### Summary
Gitlab CI fails to run a pipeline if include:rules and reusable rules are combined.
### Steps to reproduce
1. Add the following `.gitlab-ci.yml`
```
.default_rules:
rules:
- if: $CI_COMMIT_REF_NAME == "main"
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
include:
- local: '/.gitlab/workflows/ansible.yml'
rules:
- !reference [.default_rules, rules]
- changes:
- pi/**/*
- .ansible-lint
- local: '/.gitlab/workflows/script.yml'
rules:
- !reference [.default_rules, rules]
- changes:
- script/**/*
- pyproject.toml
- .pylintrc
```
2. Run the pipeline
3. See error `include:rule config should be a hash` (https://gitlab.com/serkonda7/ci-rule-bug/-/pipelines/1097314616)
### Example Project
https://gitlab.com/serkonda7/ci-rule-bug
### What is the current *bug* behavior?
The pipeline does not run.
### What is the expected *correct* behavior?
The pipeline should run fine and respect the rules.
### Relevant logs and/or screenshots
<!-- Paste any relevant logs - please use code blocks (```) to format console output, logs, and code
as it's tough to read otherwise. -->
### Output of checks
<!-- If you are reporting a bug on GitLab.com, uncomment below -->
<!-- This bug happens on GitLab.com -->
<!-- /label ~"reproduced on GitLab.com" -->
#### Results of GitLab environment info
A selfhosted instance from October 2023
### Possible fixes
<!-- If you can, link to the line of code that might be responsible for the problem. -->
issue