TAIPEI—As soon as President Tsai Ing-wen won election this year, the long lines of mainland Chinese visitors waiting for pineapple cakes outside the Chia Te bakery began to shrink.

China switched off its tourist flows as economic punishment against a candidate with many pro-indepedence supporters. It was an instant blow to the owner of Taipei’s famous bakery, Chen Tang-peng, whose semisweet pastries delight Chinese palates.

Now,...