### Godot version

4.1.stable

### System information

Godot v4.1.stable - elementary OS 7 Horus 7 (Ubuntu 22.04) - Vulkan (Mobile) - dedicated AMD Radeon RX 6600 (RADV NAVI23) () - Intel(R) Core(TM) i5-8500 CPU @ 3.00GHz (6 Threads)

### Issue description

Tilemap has a memory leak where if you repeatedly change the tile (that has collidable physics) of cells, the static memory (shown in the debugger) increases and stays there. This only happens if you have a physics layer in the Tileset and one of the tiles is collidable.

Also the memory usage is extremely high even when generating the map once. A 1000x1000 tiles map uses 1.4 GB of memory!

Workaround is simple. Simply clear the tilemap with `clear()` before you change the map.

### Steps to reproduce

1. Create a TileMap node
2. Create a TileSet containing two tiles on the atlas coordinates `(0, 0)` and `(1, 0)`
3. Create a Physics Layer in the TileSet and make one of the tiles fully collidable
4. Attach a script to the TileMap
5. Set the script to this
```
extends TileMap

func _process(delta):
	if Input.is_key_pressed(KEY_SPACE):
		for i in range(5000):
			set_cell(0, Vector2i(i, 0), 0, Vector2i(randi_range(0, 1), 0))
```
6. Run the scene
7. Go into "Debugger" tab in the editor while the scene is running
8. Press the "Monitors" tab press and observe the "Static" memory
9. Now hold down the space bar and observe the static memory climbing but never coming down
10. To workaround the problem simply add `clear()` before the loop like this:
```
extends TileMap

func _process(delta):
	if Input.is_key_pressed(KEY_SPACE):
		clear()
		for i in range(5000):
			set_cell(0, Vector2i(i, 0), 0, Vector2i(randi_range(0, 1), 0))
```

### Minimal reproduction project

[tilemapmemoryleak.zip](https://github.com/godotengine/godot/files/12064640/tilemapmemoryleak.zip)
struct TileMapLayer {
		String name;
		bool enabled = true;
		Color modulate = Color(1, 1, 1, 1);
		bool y_sort_enabled = false;
		int y_sort_origin = 0;
		int z_index = 0;
		RID canvas_item;
		HashMap<Vector2i, TileMapCell> tile_map;
		HashMap<Vector2i, TileMapQuadrant> quadrant_map;
		SelfList<TileMapQuadrant>::List dirty_quadrant_list;
		RID navigation_map;
		bool uses_world_navigation_map = false;
	};
	LocalVector<TileMapLayer> layers;
	int selected_layer = -1;
	
	HashMap<RID, Vector2i> bodies_coords;
	
	HashMap<RID, int> bodies_layers;
	
	Vector2i _coords_to_quadrant_coords(int p_layer, const Vector2i &p_coords) const;
	HashMap<Vector2i, TileMapQuadrant>::Iterator _create_quadrant(int p_layer, const Vector2i &p_qk);
	void _make_quadrant_dirty(HashMap<Vector2i, TileMapQuadrant>::Iterator Q);
	void _make_all_quadrants_dirty();
	void _queue_update_dirty_quadrants();
	void _update_dirty_quadrants();
	void _recreate_layer_internals(int p_layer);
	void _recreate_internals();
	void _erase_quadrant(HashMap<Vector2i, TileMapQuadrant>::Iterator Q);