Interesting question.
Just a guess. I suppose you can create a script that will use Discourse’s API doing a PUT request on https://yourdiscourse.com/admin/themes/[id_theme] with the body {"theme":{"enabled":false}} (false to disable or true to enable).
I may try tonight.