Revert "minor #10241 [DependencyInjection] made some perf improvements (fabpot)"

This reverts commit 181e460984eb93ef6ca2b52563ef455c24092937, reversing
changes made to ff1749302950ae8b78c18be4385d839c16cfe8c8.
[DependencyInjection] keep some of the reverted perf optim
bug #12823 [DependencyInjection] fix PhpDumper (nicolas-grekas)

This PR was merged into the 2.6 branch.

Discussion
----------

[DependencyInjection] fix PhpDumper

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #12815
| License       | MIT
| Doc PR        | none

Commits
-------

7887a46 [DependencyInjection] keep some of the reverted perf optim
2f0b355 Revert "minor #10241 [DependencyInjection] made some perf improvements (fabpot)"