The problem is that
grub-install install a bios-based (i.e. in real-mode) chunk into the boot sector. Yes, this is that old "real mode" from the PC/XT/AT era, most *86 machines are booting in this mode until now.
The BIOS doesn't know anything from your devices. In the bios, the block devices have a sinlge hexa byte identifier: floppy disks had 0x00, 0x01, ..., and hard disks have 0x80, 0x81, 0x82, ... (CDROM, pendrives are unknown for the bios, but in most cases there is some type of emulation which gives them look as if they were hard disks).
grub-install is called, it needs to say to this real mode boot code, from which devices should he load the next stages of the boot loader. This is the grub, which you soon know.
devices.map, you says the grub installer, how should he install the bios boot loader, thus you give a mapping between your block devices, and their bios numbers (soon in the boot time!). It must be somewhere in
/boot/grub or in
/boot/grub2, or similar.
After you installed grub into your loopback device, it is highly suggested to revert your
devices.map to its original state.
If you know, that the loopback device on which you now the grub install, will be the first hard disk during the first stage of the boot, you could give it simply the bios identifier 0x80.
P.s.: It is the only way to say the bios, what to know with your loopback device. In the era of the bios development, the loopback devices were very, very esoteric things known only for big machines.
P.s.2.: There is a tool named
kpartx which can find the partitions of any file or device, and map them into device mapper block devices. I played a lot with
losetup .. ---offset solutions as you, at least a short googling for that I suggest to strong.