If you experience lingering pain or soreness after playing guitar, stop playing for a few days until it goes away. And if it doesn’t go away, yes, I agree that seeing a doctor is a good idea.
As @Johannes is pointing out, there is primarily one thing that matters when it comes to wrist pain, and it is keeping it straight. If you’re looking at the thumb, you’re looking in the wrong place. You want a wrist position with as close to no flexion-extension as possible. Whatever thumb position gives that to you is “correct”, and that means there are multiple “correct” ways. The “blues” approach, as @Drew calls it, with the thumb over the top will produce this. As will several other approaches. Straight wrist.
If you are trying to play wide stretches on the low strings, you are going to see some wrist flex. That is precisely a worst-case scenario. Don’t play those lines, or don’t play them all the time or for long amounts of time at once.
“Sometimes the only winning move is not to play.”