You could try adding iso-scan/filename=$isofile to the linux line. This option does exactly what is needed when booting an ISO via a GRUB loopback device.
It is documented in man dracut.cmdline under “iso-scan/filename”, and says that the parameter causes dracut to mount the available devices and search for the ISO specified by the argument, then set the ISO up as a loop device.
The man page also provides a GRUB loopback example using iso-scan/filename=$isofile.
So in your case, try changing
linux (loop)/boot/x86_64/loader/linux install=hd:$isofile splash=silent quiet
to
linux (loop)/boot/x86_64/loader/linux install=hd:$isofile iso-scan/filename=$isofile splash=silent quiet