Yeah, this confused me for a while as well, but here’s what you need to do.
What you need to do is take the output of /home/pi/RetroPie/emulators/RetroArch/tools/retroarch-joyconfig
and add it to the end of /home/pi/RetroPie/configs/all/retroarch.cfg
Just pipe the output of retroarch-joyconfig into a file and append that file to the end of retroarch.cfg
That should do it.