[FrameworkBundle] Determine templating.engine.php scope as late as possible

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11653
| License       | MIT
| Doc PR        | -
this is a bit dangerous. If another compiler pass changes one of the arguments (for instance adding an anonymous service rather than creating a private service and referencing it), you will get a fatal error because of the typehint