Loyalty cards are opt-in. Credit/debit card let them track without opt-in.
This. CVS and its ilk rely on loyalty cards to track the hell out of your purchasing habits, but they'll certainly use your credit card to do so if you don't use a loyalty card (which I at least don't unless there's an actual sale one what I'm buying that requires it), and of course use some huge data clearinghouse to aggregate purchases from other credit card transactions, loyalty card or no.
There are means to track Apple Pay transactions as well, but it's significantly harder.
Some places where I live (in the US) have started offering discounts for paying in cash. The thing everybody seems to forget is that these payment processors skim money off every transaction, and that's terrible for small businesses. I pay in cash whenever possible because I want that money to go to my deli and not some big corporation.
The way I figure it, the merchant pays about 2-3% fees, give or take, and I get 1-2% of that back in rewards (depending on store), so the other 1% (which in the end is factored into the price of goods) is split between the occasional extended warranty benefit and what I'm willing to pay for the convenience of not having to carry cash around. Even if stores offered a cash discount that directly mapped to CC fees, I'd probably still use a credit card a lot of the time just to make life easier.
Heck, if I only have a couple of items there are times I'm finished paying with ApplePay before the person who was ahead of me has even finished bagging their groceries.
Particularly with big corporate retailers, I can either give them that 2-3%, or keep 1-2% of it myself and give the other 1% to some other big corporation. There's no way I don't come out ahead using a credit card that way.
I do tend to use cash at small local stores, but actually based on my (admittedly limited) experience with retail, unless the owner is also running the register there's a nonzero chance that a small store comes out ahead with credit cards because the till isn't getting skimmed.