The way to stop it is to introduce a law that does exactly the opposite: that encrypted communication is always protected and should always be protected and that no legislation shall be introduced that weakens these technical guarantees.

That way, it essentially has to do a two step solution, of repealing the previous law that prohibits it, and then introducing their own.

Unfortunately the EU has no 2nd Amendment, or they could go the route of classifying encryption as a munition.