I finally released a plugin that’s been in the works for a while.
Kirby Walker gives you a few PHP classes that allow you to easily traverse Kirby’s content models (site, pages, files). You can use those classes to reliably export content and import it back. I’ve been using it for some time now to do localization and it works great. It also has the ability to encode KirbyTags as XML, so that other systems (e.g. TMS) don’t get confused by them. It can transform Markdown back and forth as well.
You could use it as a dependency in your own plugin to solve the problem of correctly traversing structure, blocks, and layout fields.
Check it out: