Merging two dicts is much easier in Python 3.9 with the | operator.
x = {'p': 1, 'q': 2}
y = {'q': 3, 'r': 4}
z = x | y
If you wanted to simply append the k, v pairs of y to the end of x, you can use the shortcut.
x |= y
Nevertheless, I would never have thought of your method. Great job!