### Godot version

v4.2.dev3.mono.official [013e8e3af]

### System information

Godot v4.2.dev3.mono - Windows 10.0.22621 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3050 Ti Laptop GPU (NVIDIA; 31.0.15.3598) - AMD Ryzen 7 5800H with Radeon Graphics (16 Threads)

### Issue description

When creating and attaching a built-in script to any type of node, trying to drag nodes from the scene-tree results in an error that appears at the bottom-right of the editor, but not in the console window. The error states:

`Can't drop nodes because script 'xxxxxxxx::xxxxxxx' does not inherit Node.`
 Even though the script clearly extends Node or any other type.

### Steps to reproduce

1. Create and add any node type to the scene tree.
2. Attach a new script, choose Built-in from the dialog.
3. Save the scene first, as at the time of writing, Godot suffers from a bug that causes it to crash if the scene was not saved first.
4. Try dragging or even ctrl-dragging a node to the script.
5. Observe the error appear at the bottom-right in a yellow-accent pop-up.
6. Nod and confirm that the bug exists.


### Minimal reproduction project

[can't drag nodes into built-in scripts.zip](https://github.com/godotengine/godot/files/12511196/can.t.drag.nodes.into.built-in.scripts.zip)

Loose files in the archive. Extract into their own folder.
// 
		Vector<ScriptLanguage::TemplateLocation> template_locations;
		template_locations.append(ScriptLanguage::TEMPLATE_PROJECT);
		template_locations.append(ScriptLanguage::TEMPLATE_EDITOR);
		template_locations.append(ScriptLanguage::TEMPLATE_BUILT_IN);
		for (const ScriptLanguage::TemplateLocation &template_location : template_locations) {
			String display_name = _get_script_origin_label(template_location);
			bool separator = false;
			int ancestor_level = 0;
			for (const String &current_node : hierarchy) {
				Vector<ScriptLanguage::ScriptTemplate> templates_found;
				if (template_location == ScriptLanguage::TEMPLATE_BUILT_IN) {
					templates_found = language->get_built_in_templates(current_node);
				} else {
					String template_directory;
					if (template_location == ScriptLanguage::TEMPLATE_PROJECT) {
						template_directory = EditorPaths::get_singleton()->get_project_script_templates_dir();
					} else {
						template_directory = EditorPaths::get_singleton()->get_script_templates_dir();
					}
					templates_found = _get_user_templates(language, current_node, template_directory, template_location);
				}
				if (!templates_found.is_empty()) {
					if (!separator) {
						template_menu->add_separator();
						template_menu->set_item_text(-1, display_name);
						separator = true;
					}
					for (ScriptLanguage::ScriptTemplate &t : templates_found) {
						template_menu->add_item(t.inherit + ": " + t.name);