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

int c = p_data.size();
	const int *r = p_data.ptr();
	int offset = 3;
	ERR_FAIL_COND_MSG(c % offset != 0, "Corrupted tile data.");
	clear();
	for (int i = 0; i < c; i += offset) {
		const uint8_t *ptr = (const uint8_t *)&r[i];
		uint8_t local[12];
		for (int j = 0; j < 12; j++) {
			local[j] = ptr[j];
		}
#ifdef BIG_ENDIAN_ENABLED
		SWAP(local[0], local[3]);
		SWAP(local[1], local[2]);
		SWAP(local[4], local[7]);
		SWAP(local[5], local[6]);
		SWAP(local[8], local[11]);
		SWAP(local[9], local[10]);
#endif
		int16_t x = decode_uint16(&local[0]);
		int16_t y = decode_uint16(&local[2]);
		uint16_t source_id = decode_uint16(&local[4]);
		uint16_t atlas_coords_x = decode_uint16(&local[6]);
		uint16_t atlas_coords_y = decode_uint16(&local[8]);
		uint16_t alternative_tile = decode_uint16(&local[10]);
		set_cell(Vector2i(x, y), source_id, Vector2i(atlas_coords_x, atlas_coords_y), alternative_tile);
	}
	emit_signal(SNAME("changed"));
}
Vector<int> TileMapPattern::_get_tile_data() const {