What happens when you indirectly cause the machine to fail by installing some shout 3rd party part? Are you still going to claim warranty? Walk into an Apple Store to ask for help?
Practically speaking, however, they are liable for the time to service those customers and diagnose product issues to determine that the customer was at fault. And, that extends to any future buyers of used devices. And, any resulting displeasure from customers, even though it wasn't Apple's fault.
These sorts of things are exactly the types of problems that exist in the used car market, for exactly the same reasons.