If the following blocks are named in an anvil and then are placed and broken by the player, their name is removed:
Composter
Stonecutter
Cartography Table
Grindstone
Cauldron
Smithing Table
Loom
Fletching Table
Lectern
If the following blocks are named in an anvil and then are placed and broken by the player, their name is removed:
Composter
Stonecutter
Cartography Table
Grindstone
Cauldron
Smithing Table
Loom
Fletching Table
Lectern
All of these don't have block entities, so they can't save their names (with the exception of lectern, but that doesn't have a UI).