Repository: godot
Issue: Theme inheritance for custom types seems broken
Labels: bug,topic:gui

### Godot version

4.0.dev (17c62a692)

### System information

Windows 10, Vulkan, AMD Radeon RX 6700 XT

### Issue description

**TLDR:**
In the inspector and theme editor custom definitions for inherited classes as well as variants are not considered correctly.
They don't show up in the inspectors "Theme Overrides"
Partially in the theme editor with ("Show Defaults")
Fully in the import tab of the theme editor

**Story:**
Atm I work on a rather complex control hierachy with several levels of inheritance and theme overrides at some places. However there is a strange thing going on there...

To get the editor working with custom defined theme properties at all, I created a singleton gdscript to register the types and variants using code.

**BaseTypes:**
For base types defined in cpp it is pretty easy. I just need to call the appropriate method in the setup script to add my own properties and that works pretty consistently.
They show up in the inspector under "Theme Overrides" as well as in the theme editor when "ShowDefault" is enabled.

**Script Class:**
For inherited types with a "class_name" it starts to behave in a weird unpredictable way.
You can define a theme type "Script" and add some additional values.

In the inspector it only shows theme items added to the underlying cpp class (Control), but not the one from the scripts class_name (ScriptClass).

In the theme editor it shows the one of the class_name (ScriptClass) but not from the base cpp class (Control).
If you however set the base type of "ScriptClass" to the cpp class explicitly this turns around and it stops showing the class_name (ScriptClass) ones but the base type (Control) ones appear.

**Inherited Class**
In the theme editor it shows the one of the class_name (InheritedClass) but not from the class (ScriptClass).
If you however set the base type of "InheritedClass" to the "ScriptClass" explicitly this turns around and it stops showing the class_name (InheritedClass) ones but the base type (ScriptClass) ones appear.

**Variants:**
Basically the same as as **Inherited Class**

**Other**
The project theme configuration, manually applied themes, custom types as well as type variants are also not considered. Added definitions neither affect the "Theme Overrides" nor the "Show Default" option in the theme editor.

I guess the underlying issue has sth todo how Control::_get_property_list is setup atm
more. I think it would make much more sense if all properties are shown or the full hierarchy Variants and Types for the project theme, default theme as well as manually attached themes and custom definitions in the theme editor itself.

I think "get_theme_icon" already does that to some extent, but not sure.


### Steps to reproduce

I tried my best to set this project up as good as I can, buggy.theme basically shows the issue with the theme editor. I just added the overrides so the types are persisted. Empty definitions get removed on save somehow.

### Minimal reproduction project

[ThemeInheritance.zip](https://github.com/godotengine/godot/files/9729418/ThemeInheritance.zip)