The law mandates no such thing and this is an extremely common misunderstanding of how EU consumer production works.
EU consumer protection law gives you protection against manufacturing defects for up to 6 years after purchase(it's 2 years only on specific items - in general, it's 6 years).
The absolutely key word here is manufacturing defects - if you have a fault with your laptop, fridge, TV, whatever, within the first 6 months after buying it, then this law assumes the defect existed at the time of manufacturing and the manufacturer has to fix it. But, after the initial 6 months, the responsibility on proving that the defect is due to faulty manufacturing is on the customer.
So yes, you can absolutely bring in your broken laptop to apple after 2 years of buying it, without buying extra Apple Care, and ask them to fix it - but it's up to you to prove that it's broken because of a manufacturing issue. That's why Apple "snubs" at it - in vast majority of cases it's very hard for the consumer to prove that the laptop is broken because of an error in manufacturing, and not because the part has worn out.
Having said that - there are some countries in EU(for example Poland) which require that all electrical devices are covered by a full 2 year manufacturer warranty, and indeed - all Apple hardware sold in Poland comes with a 2 year warranty as standard. Which highlights another issue - EU laws are not as homogeneous as an outsider might think - for example, in UK if your product is replaced under warranty, the replacement is only covered for the duration of the original warranty. But in Poland, the law states that if an item is replaced under warranty, then the replacement has to be covered for a "fresh" duration, so a full replacement resets the time counter on the warranty.
https://europa.eu/youreurope/citizens/consumers/shopping/gua...
This sometimes results in customers being ping-ponged between seller and manufacturer a few times before the seller gives in.
Why would the seller give in, if it can always just ping the buyer back to the manufacturer one more time?
From the 'Sale and Supply of Goods Act 1994'
~~~ For the purposes of this Act, goods are of satisfactory quality if they meet the standard that a reasonable person would regard as satisfactory, taking account of any description of the goods, the price (if relevant) and all the other relevant circumstances.
For the purposes of this Act, the quality of goods includes their state and condition and the following (among others) are in appropriate cases aspects of the quality of goods—
(a)fitness for all the purposes for which goods of the kind in question are commonly supplied,
(b)appearance and finish,
(c)freedom from minor defects,
(d)safety, and
(e)durability.
~~~
I don't think a reasonable person would regard a £2000 laptop being unusable after 2 years of regular careful use as being 'Fit for purpose'.
https://www.which.co.uk/consumer-rights/regulation/consumer-...
I believe the rule here in Ireland is that defects that were present as a result of the initial engineering are covered for more years, but not wear and tear or anything that would fail due to use specifically.
https://www.smh.com.au/technology/apple-us-fined-9-million-f...