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.
Why do you use opts.controlChildFilter here, but mug & filter here: https://github.com/dimagi/Vellum/commit/ba082d7921a5deddb3dcb3600c79935f5d66a367#diff-7dec243e7443d2aa55101241b38a8575R148