Android defines the specification for partition layout. SoC vendors and OEMs are android partners that work with Google to comply with Compatibility Test Suite & Vendor Test Suite certification of the device in order to be eligible for Google app licensing and using the android trademark in their products. The certification defines mandatory (MUST BE) and optional (SHOULD BE) requirements that cover both hardware and software standards.
There are industrial UFS flash chip programming machines that factory load the UFS storage in masses during assembly of the device. Aftermarket flashing tools that you use to flash images are not industrial but the protocol to communicate with the storage is same. Before SoCs are flashed with partition images, chipmakers burned primary bootloader (also called Boot ROM) on CPU die that communicates with the UFS programmer. This is where EDL mode in Qualcomm Snapdragon SoCs lives. It is immutable and acts as root of trust for secure boot.
In the AOSP code, is there a mapping file for the partition info?
A device tree (DT) is a data structure of named nodes and properties that describe non-discoverable hardware. Kernels, such as the Linux kernel used in Android, use DTs to support a wide range of hardware configurations used by Android-powered devices. Hardware vendors supply their own Device Tree Source (DTS) files, which are compiled into the Device Tree Blob (DTB) file using the Device Tree Compiler. These files are then used by the bootloader. The DTB file contains a binary-formatted flattened device tree.