Coco Gauff rallied from a set and break down against Paula Badosa to book her place in the China Open decider.