You can use Improve YouTube! (Chrome version / Firefox version) — an open-source browser extension that can tweak YouTube in various ways, such as setting shortcut keys / hotkeys for various YouTube functionality, like setting the preferred video resolution.
After installing Improve YouTube!, you can set a shortcut key for a preferred resolution by clicking the extension's button → Shortcuts → Quality → choose a resolution → press the key you want to use as a shortcut key to switch to that resolution → click on "Save".
Screenshot of Improve YouTube's settings, where A is set as the shortcut key for the 720p resolution and D for the 1080p resolution:

Declaration of non-affiliation: I have NO AFFILIATION with the "Improve YouTube!" browser extension in any way whatsoever. I'm just a regular user who wanted to share a solution to the OP's question. I found this extension to be a relevant and helpful solution, since it allows me to set shortcut keys for various YouTube functionality, such as the one OP described.