IIRC credit card numbers change when the card is renewed, but at the bank all those numbers refer back to one 'base' number for that card.
So once they have the number they have the number...
I gave up all my credit cards years ago, for just that reason. I use only debit cards online today. They work almost exactly like credit cards, with one major exception. I have complete control over the credit line. No one can charge my card without my permission. I have to explicitly authorize the purchase by "funding" my card, before I buy. I typically keep a very low balance in the account, to prevent unauthorized transactions. Even so, there have been instances where unauthorized charges were attempted on the card. One time the unauthorized transaction succeeded, in debiting some small amount like $13 from the card. When I called my bank to dispute that transaction, they then informed me that there were a whole series of failed transactions just before that one. It seems someone tried to charge a few thousand dollars, then when that failed, they lowered the amount and tried again, and this went on for several transaction attempts until they got through with $13, which was close to what I had in the account at the time. The fact that they were "seeking" to find an amount that they could charge on the card itself, indicated fraud. So, the bank immediately reversed the charges, and issued me with a new card, with new number.
I discovered years ago, that some unscrupulous merchants would use their customer credit cards as a way to get a "quick loan" to fund their ongoing operations. This seemed to be a standard practice in internet service businesses. The first time this happened to me, was when I subscribed to an internet provider for dial-up "bronze" service, and some time later found my recurring monthly fees were "automatically" increased to "platinum member." At that time, I wasn't accustomed to getting unauthorized charges on my credit cards, so I used to just pay my credit card balance off every month without checking the items in detail. It was a few months before I found this out, and then it took another 6 months fighting with them, and my card company to get back my money. I figured that if they did this with their entire customer base, and claimed "computer error" they'd effectively get something like a 6 month loan or more, and some customers might not even notice.
After this type of thing became more common, I started to watch my monthly statements like a hawk. Today, with online access to card accounts, I watch the balance and transactions several times a month. The last time when that unauthorized charge of $13 appeared in my account, I caught it within 2 days, and reported it immediately. So, they can try it with debit cards too, but the way the debit card works, gives the card holder much more protection from unauthorized charges than credit cards.
With a credit card, the VISA or Mastercard extends credit to the card holder, and so the card holder has no control over who can charge that card, he then has to fight to get his money back, which takes time. With debit card, that problem goes away, for the most part, by judiciously increasing or decreasing the actual credit line available through funding and de-funding the card account on an "as needed" basis. So, even if the card details are stolen, it's still much harder for the unauthorized transactions to succeed.
Since I switched to debit cards, I have only had 1 unauthorized charge appear in the last 6 years. Previously, with my credit cards, every year I'd be disputing 2 or 3 unknown transactions that magically appeared on my card. So, I'd say things are much improved since I switched to PayPal and Debit Cards for all online purchases.