Apple wouldn't be doing it if it cost them significantly, as we see with them compromising their supposed values under Chinese pressure.
The reason companies do this is not to be a friendly company in general and care about the world and it's people. If that was the point, they would have created a non-profit or similar. The criticism of hypocrisy should come when they make those ads instead.
Look at the Activision/Blizzard situation where a player was banned for speaking for a cause they believe in, they release different statements in different countries (one pro-China in China and one not pro-China in the US), and applies different rules in different cases where it makes sense for the market. In China, shouldn't speak about freedom for Hong-Kong and in the US, it's important you support LGBT. The company will reflect that in their advertisement, where they want people to buy their products.