### Godot version

v4.1.beta2.official [a2575cba4]

### System information

Godot v4.1.beta2 - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 2070 SUPER (NVIDIA; 31.0.15.3141) - AMD Ryzen 9 3900X 12-Core Processor (24 Threads)

### Issue description

With the latest 4.1.beta2 static variables will now raise an error in console and log. No crash, only a error:
```
USER ERROR: Condition "p_elem->_root != this" is true.
   at: remove (./core/templates/self_list.h:80)
```
I don't know if pull #78138 has anything to do with it?

Anyway, if `static` keyword will removed, the error is gone.

### Steps to reproduce

Pretty simple:

Make a new scene, attach a new script and copy/paste this:

```GDScript
extends Node2D

static var my_static_int: int = 0

func _ready() -> void:
	pass
```

Run scene and close it.

### Minimal reproduction project

N/A
} else {
				top->static_variables.write[member->index] = value;
				return true;
			}
		}
		top = top->_base;
	}
	return false;
}
void GDScript::_get_property_list(List<PropertyInfo> *p_properties) const {
	p_properties->push_back(PropertyInfo(Variant::STRING, "script/source", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NO_EDITOR | PROPERTY_USAGE_INTERNAL));
	List<PropertyInfo> property_list;
	const GDScript *top = this;
	while (top) {
		for (const KeyValue<StringName, MemberInfo> &E : top->static_variables_indices) {
			PropertyInfo pi = PropertyInfo(E.value.data_type);
			pi.name = E.key;
			pi.usage |= PROPERTY_USAGE_SCRIPT_VARIABLE; 
			property_list.push_back(pi);
		}
		top = top->_base;
	}
	for (const List<PropertyInfo>::Element *E = property_list.back(); E; E = E->prev()) {
		p_properties->push_back(E->get());
	}
}
void GDScript::_bind_methods() {
	ClassDB::bind_vararg_method(METHOD_FLAGS_DEFAULT, "new", &GDScript::_new, MethodInfo("new"));
}
void GDScript::set_path(const String &p_path, bool p_take_over) {