### Godot version

4.01

### System information

Windows 10

### Issue description

It seems a tiles Custom Data is cleared/not set when "Local to Scene" is enabled for the TileMap in the Resource section. At least the custom data isn't set by the time of the _ready function in the script attached to the TileMap.

### Steps to reproduce

create TileMap and tileset with custom data and attached script. in _ready method attempt to read custom data from a used cell. 

In Attached project run it. It will print_debug if it found custom data or not. "Local to Scene" is enabled so it will not find the custom data.

### Minimal reproduction project

[TileMapCustomDataLocalBugReproduce.zip](https://github.com/godotengine/godot/files/11470771/TileMapCustomDataLocalBugReproduce.zip)

return allow_transform;
}
TileData *TileData::duplicate() {
	TileData *output = memnew(TileData);
	output->tile_set = tile_set;
	output->allow_transform = allow_transform;
	
	output->flip_h = flip_h;
	output->flip_v = flip_v;
	output->transpose = transpose;
	output->texture_origin = texture_origin;
	output->material = material;
	output->modulate = modulate;
	output->z_index = z_index;
	output->y_sort_origin = y_sort_origin;
	output->occluders = occluders;
	
	output->physics = physics;
	
	output->terrain_set = -1;
	memcpy(output->terrain_peering_bits, terrain_peering_bits, 16 * sizeof(int));
	
	output->navigation = navigation;
	
	output->probability = probability;
	
	output->custom_data = custom_data;
	return output;
}
void TileData::set_flip_h(bool p_flip_h) {