After working on restructuring my whole mod, to bring it as close to @Cadiboo's example as I could, this still wasn't working. (But my mod was so much better structured. Thanks, @Cadiboo!)
Then I discovered what the problem had been all along. I had been using an old convention available for KeyBindings, which evidently worked up to and including 1.12. My categories were named 'key.category.batty'. This must now be 'key.categories.batty'. I also had the KeyBindings themselves named e.g. 'key.batty:infodisplay' and this should now be 'key.batty.infodisplay'.
One or the other (or both) of these were responsible for my problem. It's very strange, because the whole key binding worked fine while I was in game. It's just that it forgot the key bindings which had been changed the next time I entered game.
Anyway. All solved. I just thought I would post this in case anyone else wanders into similar problems. It's all in the name!