Add race condition test case for config loading + fix race condition related to watchStop (#38747)