Congrats! Indeed ... what happened to those tables? Who knows!
In looking over this thread, at the beginning, you said ...
"We create those courses (with my software of course) by backing up original templated course, then restore into the new term courses, one for every time slot we teach that course in."
Have just finished helping a gentleman do pretty much the same thing with scripts
from command line. Using moosh. OP made one no user backup of his
template course (no user, with whatever theme/addons/blocks, etc.). Saved the backup to a location on the server and renamed it 'restorethisone.mbz'.
In the admin/cli/ area of one of the moodle instances, this bash shell script (called restoretemplate here):
(contents below)
echo 'Template course restored to Misc. category of site. Cat ID 1';
moosh -n course-restore /path/to/restorethisone.mbz 1
Restores the template backup to category ID 1 which is Miscellanous by default. Pretty easy for Op ... just executes the script once ... like ./restoretemplate [ENTER]. When it finishes, 'up arrow' for command line repeat previous command, ENTER ... repeat ... repeat ... repeat ... however many template courses OP desires to restore that session.
Template courses are restored like Template, Template copy 1, Template copy 2, etc.
however many times the op executes that script.
Op then logs onto the site, accesses each course and changes basic info in a course to 'band them'. Template copy 1 might become "Puncuation and Grammer 101 - SMU", Template copy 2 might become "Puncuation and Grammer 101 - Texas Tech", etc. and then moved to an appropriate category via Moodle UI.
And Op ends up with the same thing ... only no programming required.
'spirit of sharing', Ken