It looks like its this part
while [[ -z "\$key" ]]; do
\$es_bin "\$@"
echo "EmulationStation will restart in 5 seconds. Press a key to exit back to console."
IFS= read -s -t 5 -N 1 key </dev/tty
which is in
/home/pi/RetroPie-Setup/scriptmodules/supplementary/emulationstation.sh
Its the $es_bin that restarts ES, so I guess you could just take that out.
I really need to improve my scripting to understand it better though :)