### Godot version

4.0.stable

### System information

Ubuntu, AMD Ryzen 5 2600, GTX 1650, Vulkan

### Issue description

When putting Tilemaps with lots of tiles on Parallaxlayers, it massively slows down Godot from roughly around 600fps to 20fps. This happens whether or not the parallaxlayers are invisible, have lightoccluder information, or have collision. It seems just the process of having lots of tiles exist slows it down. 

### Steps to reproduce

Open the minimal project and convert the 2 parallaxlayers from parallaxlayers to basic node2ds and watch the FPS massively increase.

### Minimal reproduction project

[ParallaxTilemap.zip](https://github.com/godotengine/godot/files/11566812/ParallaxTilemap.zip)

TerrainConstraint c = TerrainConstraint(this, p_path[i], neighbor_list[i], p_terrain);
		c.set_priority(10);
		constraints.insert(c);
	}
	
	for (TerrainConstraint c : _get_terrain_constraints_from_painted_cells_list(p_layer, painted_set, p_terrain_set, p_ignore_empty_terrains)) {
		constraints.insert(c);
	}
	
	output = terrain_fill_constraints(p_layer, can_modify_list, p_terrain_set, constraints);
	return output;
}
HashMap<Vector2i, TileSet::TerrainsPattern> TileMap::terrain_fill_pattern(int p_layer, const Vector<Vector2i> &p_coords_array, int p_terrain_set, TileSet::TerrainsPattern p_terrains_pattern, bool p_ignore_empty_terrains) {
	HashMap<Vector2i, TileSet::TerrainsPattern> output;
	ERR_FAIL_COND_V(!tile_set.is_valid(), output);
	ERR_FAIL_INDEX_V(p_terrain_set, tile_set->get_terrain_sets_count(), output);
	
	Vector<Vector2i> can_modify_list;
	RBSet<Vector2i> can_modify_set;
	RBSet<Vector2i> painted_set;
	for (int i = p_coords_array.size() - 1; i >= 0; i--) {
		const Vector2i &coords = p_coords_array[i];
		can_modify_list.push_back(coords);
		can_modify_set.insert(coords);
		painted_set.insert(coords);
	}
	for (Vector2i coords : p_coords_array) {
		
		for (int j = 0; j < TileSet::CELL_NEIGHBOR_MAX; j++) {