### Godot version

4.1.1

### System information

windows 11

### Issue description

When registering a type with class_name and using that class name to declare a variable in code only, autocomplete works as expected anywhere in other nodes/scenes. However, if making a custom scene node that extends a script with the class_name, if that custom scene is instantiated in a different scene, even if the type is specified, it only shows the parent node's functions and not any of the extended functionality. I have made a basic project showing the issue

### Steps to reproduce

I have made a very simple project showing the issue. https://github.com/mmmmmmmmmmmmmmmmmmmdonuts/godot_4_autocomplete_issue essentially, the extended Node scene will only show the custom function when both the type is specified as well as the type afterwards following "as" 
e.g. `@onready var my_class_4: MyClass = $MyClass4 as MyClass`

### Minimal reproduction project

https://github.com/mmmmmmmmmmmmmmmmmmmdonuts/godot_4_autocomplete_issue
case GDScriptParser::COMPLETION_SUBSCRIPT: {
			const GDScriptParser::SubscriptNode *subscript = static_cast<const GDScriptParser::SubscriptNode *>(completion_context.node);
			GDScriptCompletionIdentifier base;
			if (!_guess_expression_type(completion_context, subscript->base, base)) {
				break;
			}
			_find_identifiers_in_base(base, false, options, 0);
		} break;
		case GDScriptParser::COMPLETION_TYPE_ATTRIBUTE: {
			if (!completion_context.current_class) {
				break;
			}
			const GDScriptParser::TypeNode *type = static_cast<const GDScriptParser::TypeNode *>(completion_context.node);
			bool found = true;
			GDScriptCompletionIdentifier base;
			base.type.kind = GDScriptParser::DataType::CLASS;
			base.type.type_source = GDScriptParser::DataType::INFERRED;
			base.type.is_constant = true;
			base.type.class_type = completion_context.current_class;
			base.value = completion_context.base;
			for (int i = 0; i < completion_context.current_argument; i++) {
				GDScriptCompletionIdentifier ci;
				if (!_guess_identifier_type_from_base(completion_context, base, type->type_chain[i]->name, ci)) {
					found = false;
					break;
				}
				base = ci;
			}
			
			if (found) {