You would not only need to consider how much it brings in but also how much it would cost to pull back. They would have to unwind a ton of legal structures, get rid of employees and live up to contracts that are already in place. This would take years and would be more than enough time for competition to smoothly make a transition.
Then you are also thinking of Apple as some kind of US entity. It's a faceless shareholder owned business. The shareholders would somehow need to agree to leave a still very profitable region. They would only agree to that if they think the company can force other regions or the EU to not legislate Apple. It's a risky strategy that could work but I don't think you can get the majority of shareholders to try it. Even then it could fail and just bankrupt the company.
You also have to consider how much it costs to actually comply. The board would probably much rather Apple comply and keeps selling iPhones and services in the EU vs not getting ANY profits at all from their currently second largest region in the world.
Then you are also thinking of Apple as some kind of US entity. It's a faceless shareholder owned business. The shareholders would somehow need to agree to leave a still very profitable region. They would only agree to that if they think the company can force other regions or the EU to not legislate Apple. It's a risky strategy that could work but I don't think you can get the majority of shareholders to try it. Even then it could fail and just bankrupt the company.