A "rule" here is pointless. It matters what you feel like, and what the consequences are of getting the remaining layers wet.
Your body will tell you whether it is too hot or too cold at the moment. Generally it is good to follow that by adjusting clothing accordingly.
There are some exceptions when you know the short term future will be rather different, and you will soon feel the opposite of hot/cold you are feeling now.
For example, while hiking up a hill in winter, you might strip down to avoid getting to hot. That's fine. When you get to the summit, you still feel fine. But, this is where you need to use your brain too. You know that you will cool down rapidly due to no longer exerting yourself as much. The smart thing to do is to put layers on as soon as you get to the top. 10 minutes later you will be comfortable, instead of cold, and then having to deal with changing layers once you're already cold.
Hiking in the rain in hot conditions can feel good. However, consider the future effect of the layers you currently have on being wet. If it's 115 °F in the desert, and the rain is a passing thunderstorm, then getting the cotton T shirt you're wearing wet may be useful. I have actually soaked a cotton T shirt in a river on a hot day to be more comfortable.
If it's cooler and a front is coming in that will drop the temperature 20 °F for hours, it may not be so good. You might get cold later, especially if there is wind, and then a rain shell over a wet cotton T shirt could be uncomfortable at least. If you have dry layers in your pack you can swap on, then maybe it's not so bad.
So in summary, follow what your body tells you, but also keep in mind future conditions and what you have for reserve layers to decide what to do in the moment.