I was at a Döner place where to pay cash, I had to feed the cash to a machine. I'm pretty sure it's scanning the notes for more than being fake. At supermarkets the ever more popular self-service terminals probably process most of the payments by now also might scan whatever.
You can still opt out but as long as you have to actively opt out and know what scans your notes, it's an up-hill battle.
Do ATMs record the serial numbers? If so, why? If notes are fungible, they absolutely should not track that data linked to to your account. Do they do that? I assume so but cannot know. Same with the receiving machines that have scanning capability.