Refined predictBeanType's typesToMatch check for FactoryBeans

GroovyScriptFactoryTests passes again now.

Issue: SPR-10304