Model repeat writer refactor

Refactor the writer, similar to what was done in https://github.com/dimagi/Vellum/pull/284

Best reviewed commit-by-commit.
In addition to using a filter to remove nodes from a mug's list of children, it is possible add nodes and even manipulate the hierarchy. The tricky part is making a mug-like object with the proper interface used by the writer.