Companies are made up of people, and the people are liable for any laws they violate while conducting the business of the company. Furthermore if companies aren't persons, do they therefore not have any of the obligations or responsibilities of a person, to obey the law, to answer to the courts, to be held to contracts or be the subject of law suits? The argument against corporate personhood is, frankly, utterly incoherent. Clearly they are entities which can have rights and obligations, many of which are similar to and derive from those of the people of which they are composed.
What Apple is doing is more like visiting a country and being told you either have to participate in stoning someone or pay a fine, and they are paying the fine. That's why they won't operate iCloud services in China, which will instead be run by a Chinese company which Apple will have to pay for the service.