### 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_COND_V(!pattern.has(p_coords), TileSet::INVALID_SOURCE);
	return pattern[p_coords].source_id;
}
Vector2i TileMapPattern::get_cell_atlas_coords(const Vector2i &p_coords) const {
	ERR_FAIL_COND_V(!pattern.has(p_coords), TileSetSource::INVALID_ATLAS_COORDS);
	return pattern[p_coords].get_atlas_coords();
}
int TileMapPattern::get_cell_alternative_tile(const Vector2i &p_coords) const {
	ERR_FAIL_COND_V(!pattern.has(p_coords), TileSetSource::INVALID_TILE_ALTERNATIVE);
	return pattern[p_coords].alternative_tile;
}
TypedArray<Vector2i> TileMapPattern::get_used_cells() const {
	
	TypedArray<Vector2i> a;
	a.resize(pattern.size());
	int i = 0;
	for (const KeyValue<Vector2i, TileMapCell> &E : pattern) {
		Vector2i p(E.key.x, E.key.y);
		a[i++] = p;
	}
	return a;
}
Size2i TileMapPattern::get_size() const {
	return size;
}
void TileMapPattern::set_size(const Size2i &p_size) {