Minecraft 18w45a, Minecraft 18w46a
/data modify and /execute store seem to copy NBT by reference. For most NBT this has no effect, but for NBT in the tag tag of items, it results in a link between the two, where later modifying one affects the other (other examples in MC-114104).
Get an item with NBT, summon a mob, and data modify your item into its hand:
→ The husk's sword is enchanted as well.
This link will persist until either the destination or source is reloaded for any reason.
Attached is a datapack that uses a jukebox to store a list of data, and a command block used to compare two strings. Using a temporary list, the object that contains the matching string within the jukebox's RecordItem tag also contains an ID tag which is type int. After finding the correct object, the item's Item.tag.ID is set from here, then to show the bug the ID of the source is changed to 42 (from 6).
Expected behavior: The item's ID tag is set to 6.
Actual behavior: The item's ID tag is set to 42.
To test, start a new world and go to 0,0 before loading the datapack. Then run /function lookup:test