All except for the cheapest microcontrollers (everything above half dollar) have serial numbers (unique identifiers) burned into one time programmable memory.
https://www.analog.com/media/en/technical-documentation/data...
1-Wire, unique 48-bit ID. I don't remember the year it was introduced, or cost.
IIRC, their 1-wire temp sensors also have that (at least they did about 10 years ago when I was messing around with hobbyist electronics):