When you set dict2 = dict1, you are making them refer to the same exact dict object because Python never implicitly copies objects. So when you mutate it, all references to it keep referring to the object in its current state.
To copy the dictionary you need to do it explicitly like as follows:-
dict2 = dict(dict1)
dict2 = dict1.copy()