Repository: godot
Issue: Node duplicate(DUPLICATE_SIGNALS) does not duplicate signals connected by code unless they have been set with the CONNECT_PERSIST flag
Labels: topic:core,documentation

### Godot version

v3.5.stable.official [991bb6ac7]

### System information

Ubuntu 22.04

### Issue description

Duplicating a node with signals set by hand (by editor) will correctly duplicate the signals.
The same is not true for node signals set by code.

Simply put, the following code

```
extends Node2D
signal B(node)
onready var connected_by_code = $connected_by_code
onready var connected_by_hand = $connected_by_hand

func _ready():
	connected_by_code.connect("A",self,"_on_A")
	connect("B",connected_by_code,"_on_B")
	
	var copy_of_connected_by_code = connected_by_code.duplicate()
	add_child(copy_of_connected_by_code)
	var copy_of_connected_by_hand = connected_by_hand.duplicate()
	add_child(copy_of_connected_by_hand)

	print("CHECKING CONNECTED BY HAND")
	print("INCOMING: ", connected_by_hand.get_incoming_connections())
	print("OUTGOING: ", connected_by_hand.get_signal_connection_list("A"))
	print("")
	
	print("CHECKING CONNECTED BY CODE")
	print("INCOMING: ", connected_by_code.get_incoming_connections())
	print("OUTGOING: ", connected_by_code.get_signal_connection_list("A"))
	print("")
	
	print("CHECKING COPY OF CONNECTED BY HAND")
	print("INCOMING: ", copy_of_connected_by_hand.get_incoming_connections())
	print("OUTGOING: ", copy_of_connected_by_hand.get_signal_connection_list("A"))
	print("")
	
	print("CHECKING COPY OF CONNECTED BY CODE")
	print("INCOMING: ", copy_of_connected_by_code.get_incoming_connections())
	print("OUTGOING: ", copy_of_connected_by_code.get_signal_connection_list("A"))
	

func _on_A(node):
	pass
```
prints
```
--- Debugging process started ---
Godot Engine v3.5.stable.official.991bb6ac7 - https://godotengine.org
OpenGL ES 3.0 Renderer: AMD Radeon RX 6700 XT (navy_flounder, LLVM 13.0.1, DRM 3.42, 5.15.0-47-generic)
Async. shader compilation: OFF
 
CHECKING CONNECTED BY HAND
INCOMING: [{method_name:_on_B, signal_name:B, source:root:[Node2D:1265]}]
OUTGOING: [{binds:[], flags:2, method:_on_A, signal:A, source:connected_by_hand:[Node2D:1267], target:root:[Node2D:1265]}]

CHECKING CONNECTED BY CODE
INCOMING: [{method_name:_on_B, signal_name:B, source:root:[Node2D:1265]}]
OUTGOING: [{binds:[], flags:0, method:_on_A, signal:A, source:connected_by_code:[Node2D:1266], target:root:[Node2D:1265]}]

CHECKING COPY OF CONNECTED BY HAND
INCOMING: []
OUTGOING: [{binds:[], flags:2, method:_on_A, signal:A, source:@connected_by_hand@3:[Node2D:1271], target:root:[Node2D:1265]}]

CHECKING COPY OF CONNECTED BY CODE
INCOMING: []
OUTGOING: []
```

## EDIT: 
looking at the output, the only difference between the connections is the flags value, which is 2 (CONNECT_PERSIST) for the connected by hand node, changing the connection code from 
```
connected_by_code.connect("A",self,"_on_A")
``` 
to 
```
connected_by_code.connect("A",self,"_on_A",[],CONNECT_PERSIST)
``` 
Will correctly copy the signal. Whether this is by design or not will determine whether this is a bug or a documentation issue.

```
--- Debugging process started ---
Godot Engine v3.5.stable.official.991bb6ac7 - https://godotengine.org
OpenGL ES 3.0 Renderer: AMD Radeon RX 6700 XT (navy_flounder, LLVM 13.0.1, DRM 3.42, 5.15.0-47-generic)
Async. shader compilation: OFF
 
CHECKING CONNECTED BY HAND
INCOMING: [{method_name:_on_B, signal_name:B, source:root:[Node2D:1265]}]
OUTGOING: [{binds:[], flags:2, method:_on_A, signal:A, source:connected_by_hand:[Node2D:1267], target:root:[Node2D:1265]}]

CHECKING CONNECTED BY CODE
INCOMING: [{method_name:_on_B, signal_name:B, source:root:[Node2D:1265]}]
OUTGOING: [{binds:[], flags:2, method:_on_A, signal:A, source:connected_by_code:[Node2D:1266], target:root:[Node2D:1265]}]

CHECKING COPY OF CONNECTED BY HAND
INCOMING: []
OUTGOING: [{binds:[], flags:2, method:_on_A, signal:A, source:@connected_by_hand@3:[Node2D:1271], target:root:[Node2D:1265]}]

CHECKING COPY OF CONNECTED BY CODE
INCOMING: []
OUTGOING: [{binds:[], flags:2, method:_on_A, signal:A, source:@connected_by_code@2:[Node2D:1270], target:root:[Node2D:1265]}]

```

### Steps to reproduce

The code above is self explanatory, I attached an MRP below

### Minimal Reproduction Project
[duplicate_signals.zip](https://github.com/godotengine/godot/files/9540617/duplicate_signals.zip)