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

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->occluder.is_valid()) {
						if (get_occlusion_layers_count() < 1) {
							add_occlusion_layer();
						};
						Ref<OccluderPolygon2D> occluder = ctd->occluder->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);
						tile_data->set_occluder(0, occluder);
					}
					if (ctd->navigation.is_valid()) {
						if (get_navigation_layers_count() < 1) {
							add_navigation_layer();
						}
						Ref<NavigationPolygon> navigation = ctd->navigation->duplicate();
						Vector<Vector2> vertices = navigation->get_vertices();
						for (int index = 0; index < vertices.size(); index++) {
							vertices.write[index] = xform.xform(vertices[index] - ctd->region.get_size() / 2.0);
						}
						navigation->set_vertices(vertices);
						tile_data->set_navigation_polygon(0, navigation);