TileMapLayer: using `set_pattern` to paste pattern into TileMap does not overwrite tiles or change `get_used_rect()`

Godot Version

4.3

Question

I’m using code to set a pattern on to the edge of a TileMapLayer:

var rect : Rect2i = get_used_rect()

var pattern = tile_set.get_pattern(0)
set_pattern(offset, pattern)
update_internals()

if get_used_rect() == rect:
	print("TileMap dimensions not updated properly")

However, the call to get_used_rect() returns a Rect2i that does not include the new pattern.

Am I misunderstanding how to use patterns in code? The documentation makes it seem like the original TileMap is updated to include the pattern, but in practice it seems like a new TileMapLayer is created instead.

“Paste the given TileMapPattern at the given position and layer in the tile map.”