The debug "Base and World Tools" can't copy buried items. If you try to do a simple copy/paste of a square with a buried item then the pasted square will just be a regular solid with anything buried in it, and if you try to save it as a template then the YAML file won't have anything about the buried item.
1) Enable debugging. 2) Press "Backspace" to start debug mode. 3) Make a "Base and World Tools" selection which is just a single square with a burried item. 4) Save it as a template. 5) Examine the template file.