There’s a little more to it than that too. A switch is typically setting something that takes effect immediately, whereas a checkbox is a state setting that needs to be saved to take effect.
I'm not against immediate effects on switches (or any other controls), but they must clearly signal the immediate action. E.g. I've seen some UIs presenting a short spinner on its button and delaying the colors and/or the shift.
I've definitely seen checkboxes that took effect immediately as well, though rare.
There are situations were either behaviour is preferable to the other