### 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)

key_array.push_back(coords);
							key_array.push_back(flip_h);
							key_array.push_back(flip_v);
							key_array.push_back(transpose);
							Array value_array;
							value_array.push_back(source_id);
							value_array.push_back(coords);
							value_array.push_back(alternative_tile);
							if (!compatibility_tilemap_mapping.has(E.key)) {
								compatibility_tilemap_mapping[E.key] = RBMap<Array, Array>();
							}
							compatibility_tilemap_mapping[E.key][key_array] = value_array;
							compatibility_tilemap_mapping_tile_modes[E.key] = COMPATIBILITY_TILE_MODE_ATLAS_TILE;
							TileData *tile_data = atlas_source->get_tile_data(coords, alternative_tile);
							tile_data->set_flip_h(flip_h);
							tile_data->set_flip_v(flip_v);
							tile_data->set_transpose(transpose);
							tile_data->set_material(ctd->material);
							tile_data->set_modulate(ctd->modulate);
							tile_data->set_z_index(ctd->z_index);
							if (ctd->autotile_occluder_map.has(coords)) {
								if (get_occlusion_layers_count() < 1) {
									add_occlusion_layer();
								}
								Ref<OccluderPolygon2D> occluder = ctd->autotile_occluder_map[coords]->duplicate();
								Vector<Vector2> polygon = ctd->occluder->get_polygon();
								for (int index = 0; index < polygon.size(); index++) {
									polygon.write[index] = xform.xform(polygon[index] - ctd->region.get_size() / 2.0);
								}
								occluder->set_polygon(polygon);