reftable/writer: refactorings for `writer_add_record()`