Finally got a chance to check this out.
Call the first of these before a set of edits to set a mark. Call the second of these after the set of edits to glue everything between the mark and now. Bam! now they undo in one shot.
If you call mark_undo_groups, then it resets the marker to now. If you call maybe_mark, it makes a mark if none exists but doesn't move the mark to now if a mark already exists. So you can just keep calling maybe_mark and then glue_marked at the end and it'll be one group, but if you call mark all the time and then glue at the end, it'll only glue between the latest call to mark and now.
This deletes the mark; that is, it makes it so that the next glue_marked does nothing.