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

ERR_FAIL_INDEX(p_layer_id, physics.size());
	ERR_FAIL_INDEX(p_polygon_index, physics[p_layer_id].polygons.size());
	physics.write[p_layer_id].polygons.remove_at(p_polygon_index);
	emit_signal(SNAME("changed"));
}
void TileData::set_collision_polygon_points(int p_layer_id, int p_polygon_index, Vector<Vector2> p_polygon) {
	ERR_FAIL_INDEX(p_layer_id, physics.size());
	ERR_FAIL_INDEX(p_polygon_index, physics[p_layer_id].polygons.size());
	ERR_FAIL_COND_MSG(p_polygon.size() != 0 && p_polygon.size() < 3, "Invalid polygon. Needs either 0 or more than 3 points.");
	if (p_polygon.is_empty()) {
		physics.write[p_layer_id].polygons.write[p_polygon_index].shapes.clear();
	} else {
		
		Vector<Vector<Vector2>> decomp = Geometry2D::decompose_polygon_in_convex(p_polygon);
		ERR_FAIL_COND_MSG(decomp.is_empty(), "Could not decompose the polygon into convex shapes.");
		physics.write[p_layer_id].polygons.write[p_polygon_index].shapes.resize(decomp.size());
		for (int i = 0; i < decomp.size(); i++) {
			Ref<ConvexPolygonShape2D> shape;
			shape.instantiate();
			shape->set_points(decomp[i]);
			physics.write[p_layer_id].polygons.write[p_polygon_index].shapes[i] = shape;
		}
	}
	physics.write[p_layer_id].polygons.write[p_polygon_index].polygon = p_polygon;
	emit_signal(SNAME("changed"));
}
Vector<Vector2> TileData::get_collision_polygon_points(int p_layer_id, int p_polygon_index) const {