Fixed type detection to avoid reuse of parent bean's targetType on child definition merge

Issue: SPR-10374