@Koroth I just set up ryujinx on a few systems and 1 of them worked fine without needing an AHK, but the other 2 did (I am unsure why this would be the case, but I have seen this on a couple other emulators). So I tested the code below both with starting game in fullscreen and not starting in fullscreen and the games exited correctly back into LB and not into the Ryujinx UI. So give this a try.
ESC::
{
SetTitleMatchMode, 2
WinWaitActive, Ryujinx
Send !{f4}
}