I think I’m past the worst of the challenge of restructuring the entity/behavior system now. It turned out that one of the things I trashed was something I actually really wanted to keep, since it made everything much easier to work with — fortunately, this is why we have version control, and I was easily able to revert the more unpleasant changes.
With those changes in place, the new version is proceeding rather quickly. I’m able to replace a shitload of previously-necessary conversion to/from xml functions into a set of two now, one for entityprototype and one for entity, which, though they’re much more complex in their own right, make the behavior functions a lot more straightforward. All in all, now that I’ve gotten through, this is shaping up to be the best approach to this section I’ve taken thus far… which is, honestly, the least one could hope for after this amount of work.