I came up with a way to make this work for the AI... Instead of trying to make the AI understand how to pick a plot and a unit, we only need to make the AI apply the spell to a certain unit. So for instance, enchant blade could, if you were human, trigger a popup letting you pick a unit on the plot to give them Enchanted Blade. However, for the AI, the code would just give the best unit on the plot Enchanted Blade. ("best" according to some function that calculates the best unit). The same would be true for plot-picking spells like Slow... it would give a unit within one tile range the Slow promotion, whereas the human would have a choice.
I could maybe do this via python. But someone else interested would have to do it in C++.