The UK has had a similar law for a long time now, and this has been considered. It won't work. Veracrypt rejected the idea.
In the case of computers, they will clone the drive before entering the password, so wiping won't help. Some SSDs are better, in that they won't even allow the data to be read without the password first, but they don't support the duress password feature.
In the case of things like phones, you can set up a duress password that wipes the device, but using it will get you into more trouble. You might decide that trouble is worth it - there have been cases here where people have refused to give up passwords and taken the two years in jail, rather than whatever they would have got had the content of the device been seen by police.
In that case it might actually be worth having a duress password, as the risk is that even if the device is secure today, it might not be in 10 years time.
Typically the solution most people in the UK have opted for is to "lose" the phone, by say dropping it overboard in the ocean. Some of the people close to Epstein and former prince Andrew had those kinds of accidents. IIRC our former Prime Minister forgot his password. Oh yes, you can forget your password, but it needs to be credible. If you unlocked the device the day before and have been unlocking it for years... Well, maybe you could argue you changed the password yesterday and now can't remember it. I used to do that a lot when work mandated monthly password changes.