[DependencyInjection] use/fix newest Definition::setFactory

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -
I do understand why you did that but I think it does not really make sense to support such a use case. That's why I asked for a **real-world** use case. Anyway, as it would be a "new feature", I think it should be removed from this PR.