A value being wiped when you hide the field is the expected behavior, for better or worse.
A workaround looks like the following:
The gist is that each switch would need to calculate itself when not hidden, then there needs to be an editability expression set for each switch that said, if I have a value then make me editable (which disables the calculation) or if I'm null calculate me... which makes me editable again, which disables the calculation. Setting the editability expression is where you need ago or python until that option is exposed in the UI.
Each Switch --> has a value expression set to return the default value
Each Switch --> has an editability expression that by virtue of being true disables the value expression.
Now it can "be" null, but never stay null. So long as the switch has a value... on/off or true/false or 1/0 for example, then it behaves like a normal switch. If it gets hidden it becomes null. If it gets unhidden, because it is null it will calculate to false (or your default of choice), but now it has a value, so the calculation no longer applies... until it becomes null again for whatever reason... then it calculates again... and so on.
This is now a special kind of "dynamic default value"... one that if nulled comes back. In this case it is just a simple switch but it can be for any field or complexity.
- Justin Reynolds, PE