To be clear you mean that can in your config file or settings menu bind a hotkey to run a particular action if and only if that action can be specified by a particular command line operation.
This is indeed my preferred way to specify such things I like that it is centrally managed and if the application developer lets you interact with the program that way it is quite powerful.
Is this possible on gnome wayland or just under sway?
There is another form of global hotkey configuration wherein the app lets you specify a global command for an operation that may be internally specified and may not be provided via a cli interface and this functionality will never work by design.