Containers that already contain items don't drop those items when replaced by structure blocks or by commands such as /setblock, /fill...replace, and /clone.
Containers with ungenerated loot tables will instead generate and drop items when replaced in the same manner.
Linked issues
duplicates 1
Comments 2
Thank you for your report!
We're tracking this issue in MC-136917, so this ticket is being resolved and linked as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki
You're able to partially get around this if you set the loot table to "minecraft:empty" before removing the block
data merge block ~ ~ ~ {LootTable:"minecraft:empty"}