That is how it works.
First of all, it seems that many people think that this just has to do with Apple, and that is wrong. It might be that iPhones don't continually fail, but other products do. If I buy a phone from Sony (or any other product), the same law apply. Apple doesn't get to circumvent the law.
Not much is written about this case in the article. But the iPhone he received stopped working, and Apple couldn't repair it (they tried). Under the law, they are then to provide the customer with a phone equal to the one he bought, and that is a completely new phone, not a phone made up of previously used parts, no matter how great/superior/fantastic the quality of those parts are.
In this exact case, Apple themselves said, they couldn't repair the phone. Had they be able to repair it, he would have gotten his phone back, with the broken part repaired. What you apparently don't quite understand is, that Apple (or any other company for that matter) can't keep repairing the product. They can try to repair it twice and if the problem still persists, they have to replace it with a new. Had Apple been able to repair the phone, they would have the option to do so. However they weren't, and by Danish law, this requires them to replace with a new phone.
Had he bought a refurbished phone (something Apple doesn't offer in Denmark), he would have been entitled to a refurbished phone as a replacement.