AFAIAA, there is no means to do this directly using a Google Apps Script method at this time.
A possible workaround is to create a minimal Google Form, make it a quiz, and configure it to 'Immediately after each submission'. Instead of creating the form within the script, merely duplicate this Form file (using your script) and proceed to build your quiz programmatically in the copy.
It is worth noting that this omission in Google Apps Script can result in a bug in the completed quiz. When a Form is created using a script and .setIsQuiz(true) method is used to to turn it into a quiz, the "Release marks" setting defaults to "Later, after manual review". In the Forms settings User Interface, this option includes the note "Turns on email collection" - This is so that when results are released manually, there is an email address to send the results to. When a Quiz is created using the steps above, email collection is not enabled. This means it is not possible to release the results manually. The workaround described above alleviates this issue.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…