You need to do a freeze and unfreeze IO to retain the state of the pin after stop mode. Attaching the text from the GPIO appnote,
"In the case of Hibernate and Stop mode, wake up happens with a device reset. This clears the GPIO configuration and the state. To retain the pin state, use the CySysPmFreezeIo() and CySysPmUnfreezeIo() APIs. Note that you do not need to call the CySysPmFreezeIo()function for Stop mode since it is automatically called when the user invokes Stop mode using the API CySysPmStop(). However, you should call the CySysPmFreezeIo() API just before the function call to enter the Hibernate mode. The GPIOs are unlocked with the call to API CySysPmUnfreezeIo(). Call to this API is also required when the exit is made from the Stop mode. Note that the Frozen pin states and configurations are not maintained on an external reset (XRES) event. "