Repository: godot
Issue: Setter not called during duplicate for an exported property referencing an instance of a custom class 
Labels: discussion,topic:core

### Tested versions

v4.3.stable.official [77dcf97d8]

### System information

Godot v4.3.stable - Windows 11 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce GTX 1660 Ti (NVIDIA; 32.0.15.6094) - Intel(R) Core(TM) i7-9700F CPU @ 3.00GHz (8 Threads)

### Issue description

If a node includes an exported property that references a child  defined as a custom class, the setter is called as expected when the node is created (first time, or when reading a scene). However, when duplicating a node, either through the editor gui, or in gdscript, the setter is not called (for such a child defined as a custom class).


### Steps to reproduce

### Create a custom class,CustomClass, by extending a built-in class, for example:
```
@tool
extends Path3D
class_name CustomClass
```
### Create a second script to apply to a Path3D node
```
@tool
extends Path3D
```
### Create a 3D scene, add a Node3D. 
Add a CustomClass as child node, also add a further child node based on the built-in class (Path3D in this case) and attach the Path3D script. Add the following script to the Node3D to display values of properties:
```
@tool
extends Node3D

@export var path3d:Path3D
@export var custom_class:CustomClass

@export var path3d_set:Path3D:
	set(value):
		path3d_set = value
		print(	"Set path3d_set          ",path3d_set,"\n")

@export var custom_class_set:CustomClass:
	set(value):
		custom_class_set = value
		print(	"Set custom_class_set    ",custom_class_set,"\n")


func _init() -> void:
	print(		"Init .............","\n",
				"Path3D             ",path3d,"\n",
				"CustomClass        ",custom_class,"\n",
				"Path3D_set         ",path3d_set,"\n",
				"CustomClass_set    ",custom_class_set,"\n")

func _ready() -> void:
	print(		"Ready .............","\n",
				"Path3D             ",path3d,"\n",
				"CustomClass        ",custom_class,"\n",
				"Path3D_set         ",path3d_set,"\n",
				"CustomClass_set    ",custom_class_set,"\n")
```
### Assign the CustomClass and Path3D nodes to the respective properties in the editor. 
Then reload the scene, this gives the following output, note that the exported property, <custom_class> is defined as expected.

> Init .............
> Path3D                  \<null\>
> CustomClass         \<null\>
> Path3D_set            \<null\>
> CustomClass_set   \<null\>
> 
> Set path3d_set          Path3D:<Path3D#2953125619440>
> 
> Set custom_class_set    CustomClass:<Path3D#2953142401043>
> 
> Ready .............
> Path3D             Path3D:<Path3D#2953125619440>
> CustomClass        CustomClass:<Path3D#2953142401043>
> Path3D_set         Path3D:<Path3D#2953125619440>
> CustomClass_set    CustomClass:<Path3D#2953142401043>

### Duplicate the above node
Either in the GUI, or by attaching the script below to the root node of the scene, saving and running the project
```
@tool
extends Node3D

func _ready() -> void:
	var new_node = $Node3D.duplicate()
	add_child(new_node)
	new_node.set_owner(get_tree().get_edited_scene_root()) 
```
### The output will be as below

> Init .............
> Path3D                   \<null\>
> CustomClass          \<null\>
> Path3D_set             \<null\>
> CustomClass_set    \<null\>
> 
> Set path3d_set          Path3D:<Path3D#2953192733135>
> 
> Ready .............
> Path3D             Path3D:<Path3D#2953192733135>
> CustomClass          \<null\>
> Path3D_set         Path3D:<Path3D#2953192733135>
> CustomClass_set    \<null\>

### As is demonstrated, the CustomClass setter is not called during the duplicate process
The value of the property remains <null> even though defined in the original node, yet the exported property referencing a built-in class is duplicated correctly




### Minimal reproduction project (MRP)

[CustomClassExportDuplicate.zip](https://github.com/user-attachments/files/17559367/CustomClassExportDuplicate.zip)