I usually try to group pieces of functionality and all their related code (say a given node type and the commands, keybindings, and node views that allow users to work with it) into a plugin that can be easily enabled in an editor. For schema pieces or markdown parsers/serializers you’ll still have to export a node type or a schema-building helper, since those can’t be expressed in plugins, but those can go into the same file or directory.
Not really for anything non-trivial, but modules like the gap cursor show how you can roll the different aspects of a feature (key bindings, selection management, decorations) into a plugin.