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