Why doesn't someone use kmonad or libinput or something to make a utility that holds a database of the most-used applications and, whenever the user focuses a window, remaps the keyboard to some set of consistent system-wide bindings?

I don't think that exists, does it? EXWM comes close, but it doesn't have the database.

I know, I know, I just said "someone" when I should do it myself.

There are 3 options here.

https://github.com/mooz/xkeysnail

https://github.com/k0kubun/xremap

https://github.com/autokey/autokey

My advice is to skip the last one unless you need something truly complicated and a config syntax that is just insane regardless of your level of complexity imo.

Of course if you just want mac based keybinds to be done for you then use my kinto app.

https://github.com/rbreaves/kinto