Silly me. Turns out I forgot to cast the form data to an object. I used:
$question = (object)$form;
and was able to pass $question to the insert_record() function and have the function work correctly.
General developer forum
problem with insert_record from the Moodle API
This discussion has been locked so you can no longer reply to it.