The reason for the gaps is mainly historical and due to backwards compatibility.
Remember that disk formatting schemes were created a long time ago to store data on floppy disks (8", 5 1/4" etc) before being used for hard disk drives. So it helps to have an understanding of how magnetic disks are structured. See https://en.wikipedia.org/wiki/Cylinder-head-sector
As hard disk drives became larger, the need to partition them into individual drives became necessary to manage them more easily. Partitions were typically aligned to start on a new cyclinder. I'm not sure what the constraints were, but many of the disk partitioning tools enforced these constraints to make sure they worked on a wide variety of different drives.
Despite the CHS addressing method being largely superceeded by Logical Block Addressing (LBA), most of the old constraints are still implemented to maintain backward compatibility. Even on SD cards, the concept of CHS addressing largely lives on, even though internally they are structured into quite a different structure. The blocks/nodes and clusters that your particular disk format uses to store its data in are mapped onto the SD card blocks, mapped onto LBA, mapped onto a virtual CHS structure etc. So the constraints of CHS still live on.
SD cards typically store data in larger blocks (1K, 4K etc) so they bring an additional level of constraint. Even if the disk writing drivers want to write a 512 sector of data, the low level SD card driver has to map this to a 4K block, read the whole block, change 512 bytes and write the whole block back again. If a partition straddles such a 4K block, you can see that writing to one partition could inadvertently change data in another partition should an error occur. So to keep partitions independent of each other, the block sizes of the SD card also need to be taken into account.
The fact that we can transfer disk images between very different types of media (SD cards, magnetic hard disk drives, USB sticks etc) is largely due to the fact that all of the constraints of all of these types of media are taken into account when a drive is formatted & partitioned. Sometimes you will lose some small areas of space, but if you violate the rules, things will start breaking.
But I think most of the constraints are due to the START location of a partition. So if you must fill gaps, I think it best to do this be extending the end of the previous partition to make it a bit larger.