All Apple can do is make the best product possible within the legal constraints of each country it sells in. If it wants to sell iPhones in the United States, it has to comply with United States law. It it wants to sell in China or India or France, it has to comply with the laws in those countries.
The courts or legislators in a particular country may make bad decisions about what the laws should be. At that point Apple will have to: (1) modify products sold in that country or (2) stop selling in that country. The first choice is an option as long as country-specific product changes don't jeopardize the quality and security of products sold in other countries. Apple may be forced to stop selling products in countries with laws that jeopardize the security of Apple products sold in other markets.
Apple's competitors will have to deal with these same issues. Some will mount vigorous defenses to bad laws, some will not, but the competitive playing field should be the same on a country by country basis. I think the main thing is for Apple to take firm, ethical stands against legal and governmental overreaching, protecting the user's security and privacy as much as possible. Companies that don't do everything they can to protect user security/privacy will suffer big hits to their reputation and their ability to attract and retain customers.
The author owns stock shares of Apple.