Have you ever heard of someone having an alternator go bad and then the dealer blaming an aftermarket part on it in the first place?
I've never had dealers seek out aftermarket modifications when I get service done at all. They just want to get cars in & out quickly, and they bill the manufacturer for warranty work anyway so why would they care if you had related aftermarket modifications? They only push back if they think they won't get reimbursed by the manufacturer for the warranty work. Which would tend to require "obvious" data showing modifications as a likely suspect.
Tesla changes this by having the service centers also be owned by the same company footing the bill. So this is likely to be way more common of a battle going forward, though.
Some Audi dealers would void almost your entire power train warranty for simple things like an aftermarket cold air intake.
In your scenario, that's also exactly what small claims court is for, or also contacting the manufacturer directly. In another scenario, a ground wire went faulty and a (shadier) dealer tried to get me to pay for the cost of the diagnostic. I said I can chat with GM about that cost and they very quickly said they would waive the fee.
https://www.abajournal.com/magazine/article/sweeter_lemon_la...
In real life people just generally eat it.