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

}
		
		for (int k = 0; k < ctd->shapes.size(); k++) {
			Ref<ConvexPolygonShape2D> convex = ctd->shapes[k].shape;
			if (convex.is_valid()) {
				Vector<Vector2> points = convex->get_points();
				for (int i_point = 0; i_point < points.size(); i_point++) {
					points.write[i_point] = points[i_point] - get_tile_size() / 2;
				}
				convex->set_points(points);
			}
		}
	}
	
	Vector2i max_size = get_tile_size();
	int max_count = 0;
	for (KeyValue<Vector2i, int> kv : compatibility_size_count) {
		if (kv.value > max_count) {
			max_size = kv.key;
			max_count = kv.value;
		}
	}
	set_tile_size(max_size);
	
	for (const KeyValue<int, CompatibilityTileData *> &E : compatibility_data) {
		memdelete(E.value);
	}
	compatibility_data = HashMap<int, CompatibilityTileData *>();
}
Array TileSet::compatibility_tilemap_map(int p_tile_id, Vector2i p_coords, bool p_flip_h, bool p_flip_v, bool p_transpose) {