You can use this technique: https://docs.moodle.org/dev/Overriding_a_renderer.
Probably a silly question, but isn't what you need to override the layout, not a render override but a 'layout override' (if such a thing is possible/specifiable)? I had understood the render files were for bits of content, not where they go. If you can move block positions with the render files, could someone explain how?
In the case of the quiz renderer, some of the 'bits of content' are entire pages. E.g. https://github.com/moodle/moodle/blob/master/mod/quiz/renderer.php#L48. You can see that that big chunk has been made by sticking together smaller chunks, so you can choose which bits to override.
However, that still does not control the overall layout. That comes from the theme/mytheme/layout/whatever.php files.
A theme can have as many different layout files as it likes (controlled by the $THEME->layouts array in the theme config.php file.) You may be able to get the different layouts you want just by changing that array.
Alternatively, you may need to add some if statements in one of your layouts. For example, a theme I am involved with now only has one layout.php file, which contains this code near the top:
// Certain modules have left navigation rather than right.
$leftblocks = $sidepre;
switch($PAGE->pagetype) {
case 'mod-oucontent-view' :
case 'mod-quiz-attempt' :
$extraclasses[] = 'osep-leftblocks';
$leftblocks = true;
}
Then, later on, it does different things depending on whether $leftblocks is true.