perf(core): Avoid unnecessary creating provider factory (#33742)
perf(core): Avoid unnecessary creating provider factory (#33742)

In providerToRecord move creating the factory into a condition which
actually needs it to avoid unnecessary creating it

PR Close #33742

filipesilva/angular,angular/angular,matsko/angular,angular/angular,JiaLiPassion/angular,snaptech/angular,shairez/angular,gkalpak/angular,mgechev/angular,IdeaBlade/angular,IdeaBlade/angular,gdi2290/angular,IdeaBlade/angular,ocombe/angular,brandonroberts/angular,mprobst/angular,Toxicable/angular,vikerman/angular,brandonroberts/angular,gnomeontherun/angular,Toxicable/angular,alxhub/angular,gdi2290/angular,manekinekko/angular,manekinekko/angular,filipesilva/angular,StephenFluin/angular,vikerman/angular,alxhub/angular,filipesilva/angular,gnomeontherun/angular,snaptech/angular,snaptech/angular,angular-indonesia/angular,filipesilva/angular,gdi2290/angular,matsko/angular,wKoza/angular,snaptech/angular,mprobst/angular,brandonroberts/angular,Toxicable/angular,wKoza/angular,alxhub/angular,mgechev/angular,mgechev/angular,mprobst/angular,StephenFluin/angular,mprobst/angular,JiaLiPassion/angular,ocombe/angular,gnomeontherun/angular,manekinekko/angular,Toxicable/angular,matsko/angular,mgechev/angular,angular/angular,gdi2290/angular,mgechev/angular,IdeaBlade/angular,brandonroberts/angular,snaptech/angular,manekinekko/angular,StephenFluin/angular,blesh/angular,ocombe/angular,matsko/angular,angular-indonesia/angular,manekinekko/angular,wKoza/angular,StephenFluin/angular,vikerman/angular,shairez/angular,shairez/angular,gkalpak/angular,angular-indonesia/angular,ocombe/angular,vikerman/angular,snaptech/angular,Toxicable/angular,gkalpak/angular,wKoza/angular,vikerman/angular,Toxicable/angular,mprobst/angular,ocombe/angular,gdi2290/angular,shairez/angular,IdeaBlade/angular,gkalpak/angular,shairez/angular,wKoza/angular,gdi2290/angular,alxhub/angular,brandonroberts/angular,ocombe/angular,blesh/angular,JiaLiPassion/angular,blesh/angular,gnomeontherun/angular,filipesilva/angular,angular/angular,blesh/angular,angular-indonesia/angular,vikerman/angular,alxhub/angular,mprobst/angular,brandonroberts/angular,JiaLiPassion/angular,matsko/angular,StephenFluin/angular,wKoza/angular,manekinekko/angular,blesh/angular