This sounds challenging.
We normally script our prototypes using Python but if you wish to make use of your existing question template code you'll have to use Java instead. I've never tried doing that, and my Java's very rusty anyway, so I'm not sure how easy it would be to copy the sort of design we use in our complex prototypes, but I'll describe it anyway and you can decide if any of it's useful to you.
We put as much as possible of the grader functionality into support files, one file per class. So for example we have a support file that provides us with a ResultTable class, with methods to set the column headers, add rows, manage images in columns, etc. That sounds like the sort of thing you're after?
All the Twig processing is done in boilerplate code in the template. There's a table of allowed template parameters and their default values, and the template extracts all the template parameters from {{ QUESTION.parameters }}, checking the names and types for validity. This is a great help in picking up authoring errors. A dictionary/map of parameter names -> values, PARAMS, is then passed to the constructors of all the support file classes, so they can make full use of the template parameters or other global Twig parameters like STUDENT_ANSWER, ALL_OR_NOTHING, GLOBAL_EXTRA etc.
Most of the rest of our structure, with classes for style checking, task compilation and execution, are probably not relevant to you. But if you want to look at what we do, our question type python3_stage1 is on github here. It's all somewhat messy and overcomplicated for your needs, but the ideas for doing all the Twig processing in one place (see template.py) and for managing the result table (see __resulttable.py in Files.zip) might be useful to you.
If you were to use such an approach you'd have to modify all existing templates by inserting the Twig parameter-processing code at the start and changing the template code to make calls to the ResultTable class. I'm not sure how feasible that is in Java.
You might also want to consider exporting all the questions to XML and using a program to translate the questions to a new format.
That may or may not help.