Injecting UUIDs into ROM during production
Production programmers generally have an option to serialize the image written to the memory: each individual product is flashed with data that is different, for instance by incrementing a specific data word, but more complex operations are also possible.

Another option is to buy a chip that itself has a unqiue number. This is for instance done for Ethernet addresses, which are assigned by some authority. Check for instance Microchip's "Unique ID Chip Products".

Dallas/Maxim 1-wire products can use one shared (1 wire) bus for (virtually) any number of chips. To make this work, each such chip has a unique serial number. The simplest form of these chips has nothing more than this ID.