When I brought this error up with one of our developers, we realized that the problem may be hierarchical organization. Terms in AtoM can be organized hierarchically (i.e. Broader and Narrower in SKOS terminology). In a table-based relational database, we manage these relationships using parent ID values and a
Nested set model. However, the query I provided will delete the terms in the order they are in the database, without factoring in relational position. Consequently, you might end up deleting a parent term before its children are deleted, which could lead to the kind of foreign key constraint error you encountered. When I tested the query before sharing it, I was using a Subjects taxonomy filled only with sibling terms - there were no hierarchical relations. Disabling the foreign key check allowed you to bypass that problem, which I *think* should be okay for something as broad as deleting all terms in a taxonomy, so long as you re-enable it after. I'm still hoping we can craft a better query that doesn't require that, however.
Our developer is going to take a look and see if he can prepare an updated query that will meet these requirements. If he's successful, I'll include it in the documentation, and update this thread with the query for anyone else who comes across it in the future.