Repository: godot
Issue: Custom Objects created from C# have the wrong Script resource attached.
Labels: bug,topic:dotnet

<!-- Please search existing issues for potential duplicates before filing yours:
https://github.com/godotengine/godot/issues?q=is%3Aissue
-->

**Godot version:**
v3.3.1-stable_mono_win64


**OS/device including version:**
Windows 10 64-bit


**Issue description:**
Any Object declared in C#, then instantiated with `new MyObject()` has an invalid script attached.
ResourceLoader uses a resource's `resource_path` as a kind of "cache key" to avoid reloading things. Each `Script` resource that is saved to "res://" is usually cached by the ResourceLoader using the script's file path as its `resource_path`. This ensures that the script is only loaded once. The "Minimal reproduction project" below is fairly small and reveals all in the following snippet:
```csharp
    public override void _Ready()
    {
        var custom = new CustomNode();
        AddChild(custom);
        var custom_node_script = custom.GetScript() as Script;
        GD.Print( "custom node script path was \"" + custom_node_script.ResourcePath + "\"" );

        var custom2 = GD.Load<CSharpScript>("res://CustomNode.cs").New() as CustomNode;
        AddChild(custom2);
        var custom2_node_script = custom2.GetScript() as Script;
        GD.Print( "Should have been \"" + custom2_node_script.ResourcePath + "\"" );
    }
```
The above will result in:
```text
custom node script path was ""
Should have been "res://CustomNode.cs"
```
In other words, when any object is created using the form `new CustomNode()`, the script that gets attached is not the one cached by ResourceLoader. Instead it is some detached script object.
This has major implications when saving and loading. For example, were I to set both nodes' owners to the main scene node and then pack and save it to 'user://Main.tscn', we get the following tscn:
```text
[gd_scene load_steps=4 format=2]

[ext_resource path="res://CustomNode.cs" type="Script" id=1]
[ext_resource path="res://Main.cs" type="Script" id=2]

[sub_resource type="CSharpScript" id=1]

[node name="Main" type="Node2D"]
script = ExtResource( 2 )

[node name="@@2" type="Node" parent="."]
script = SubResource( 1 )

[node name="@@3" type="Node" parent="."]
script = ExtResource( 1 )
```
The issue can be seen by comparing the first `sub_resource` to the first `ext_resource`. The desired save result is the `ext_resource`, which has a path that can be used to load the script and then the object. The first `sub_resource` fails as a "Sub Resource" as it should have below it all the information needed to re-create the object. Indeed, if we try to re-load this scene, we get an empty and invalid `CSharpScript` object that contains no real info.
Hopefully that clearly highlights the issue with not having the cached version of the script attached.


**Steps to reproduce:**
1. Run the main scene in the minimal project below

OR

1. Create a custom script in C# that inherits from an `Object`, like a `Node2D` or `Resource`.
2. Create a second script in C# and construct a new object of the type created in step 1.
3. Run the second script. The created object will not have the proper script attached.


**Minimal reproduction project:**
https://github.com/cgbeutler/godot_bug_csharp_missing_script_resource_path