So, in essence, you are telling me to just use commands to get written books for now on?
I think I have figured it out. It is about teams, and since in both of these worlds I am not in a team, it randomly chose visible or invisible.
I am in third person in both of these pictures.
The structure file in question (behavior_packs/vanilla/structures/mansion/1x2_a6.nbt) properly defines the item as
[media][media]minecraft:iron_axe
, but there's some issue with the NBT structure loader that is mutating the item ID. This is the only structure in the game that contains a chest with an item with predefined enchantments, so maybe it's something to do with that