This happens because pandas optimizes away copies when one input is empty, so they share the same memory. To prevent linkage without forcing a deep copy, enable Copy-on-Write in pandas 2.x:
pd.options.mode.copy_on_write = True