There's a simple way to avoid such fines:EU doesn't have many tech companies, they are loosing revenue from taxes, so they figured out a way to make money by imposing huge fines on tech companies.
Play fairly, don't play anticompetitively and comply with the law.
Apple were intelligent enough and had highly-enough paid lawyers to anticipate that their conduct was and is anticompetitive. Especially given controlling a computing platform having as many end users and developers as they do.