There already is a hack for the xbox360 controller. Use mouse emulation. If it breaks the other emulators, you haven’t set it up correctly. Use the xbox button as a controller mode change button. (That’s actually it’s default behavior in linux, but most people aren’t using it.)
I have this set up on my end, while it works, an actual mouse and keyboard work better. Kodi seems to block some of the keybinds done through xboxdrv. You’ll notice that in that mouse.cfg file, I have added a mapping for the dpad to act like the arrow keys. It works for me in every app that needs it on the retropie except kodi. The actual mouse emulation though, works great.
^^ my other hobby