[DependencyInjection] Added exception to avoid fatal during compile in a frozen dumped container

Q | A
------------- | ------------- | -----
Bug fix? | yes
New feature? | no
BC breaks? | no
Deprecations? | no
Tests pass? | yes
Fixed tickets | #10428 
License | MIT
Doc PR | N/A
Use single quotes for consistency with rest of the code base (I know this rule is broken in few places, but let's not introduce new issues).