[DependencyInjection] Added support for closure as a factory method

I've detached closure's part from #11953. Furthermore, there is no SuperClosure dependency anymore, because I'm not sure if I have to create bridge package by myself.