I am not a fan of the approach you have suggested. I find that having a global toggle can be confusing. The reason for this is exactly why you are unsure and asking this question - because there are strong arguments for it functioning in different ways.
I find the best approach is to just have explicit actions for selecting and unselecting all options. Something like this:
The main benefit here is that there is no confusion about what a global toggle will or won't do. The user clearly knowns what to expect by clicking on either of the links.
This also allows for the options to be further developed into a hierarchy type structure, if required. For example:
As you can imagine from this example, having a global "select all" toggle would really start to confuse the user.
A point was made in the comments that when you have a long list, the global toggle button can be useful to see at a glace if all options are selected without having to scroll the list.
If it is desirable for the user to understand this, then one option that would work with my current suggestion is to include a simple label that shows the number of items that have been selected. For example:
33/34 items selected
I think this information is not required for short lists, but perhaps any significantly long lists that would require (excessive) scrolling might benefit from include this extra information near the
select all / unselect all buttons.