How can I dynamically generate operator classes?
As you found, you can't register operators during some actions such as drawing or polling. We can define custom operators within an addons register() or within an operators execute() method, you can also manually run your script from blender's text editor without any issue.

For brevity I'll replace your for loop with a function called create_custom_operator()

def create_custom_operator(i):
    idname = "object.operator_" + i
    .... # rest as above


You can then use it in an addons register() -

def register():
    for n in ['a','b','c']:
        create_custom_operator(n)


Or you could use it in an operator's execute(). Note that I use a file list to define the operators here, we can do this in an operator's execute but not while registering an addon as we can't access the filesystem during addon registration.

class MakeCustomOperators(bpy.types.Operator):
    """Create custom operators"""
    bl_idname = 'object.add_custom_ops'
    bl_label = 'Add operators'
    bl_description ='Dynamically create multiple operators'

    def execute(self, context):
        for f in os.listdir('/path/to/data'):
            create_custom_operator(f)
        return {'FINISHED'}


I have given a more complete example in answer to the question that inspired this question.