[DI] Added safeguards against invalid config in the YamlFileLoader

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11333
| License       | MIT
| Doc PR        | n/a

Exceptions explaining the mistake are better than fatal errors or weird notices appearing when trying to deal with such invalid data.

The XML file loader is not affected by this because the data are validated with the XSD before being processed
What about adding one additional quick note at the end: `Check your YAML syntax.`

I think beginners don't think about YAML in terms of the data structure it will compile down to - so I a little extra pointer that they have a syntax issue might help. Great PR btw :).