Split brain problem with two master nodes

It is no at the risk of something like split brain, but it will not be healthy or functional, it will just stop answering to requests.

A two node cluster is not resilient to failures, if one of the nodes goes down or the nodes cannot communicate with each other, then the cluster will not work until a new master is elected, an to elect a new master you need at least 3 nodes.

So, in resume, if you remove one node to change the OS and this node is not the active master, your cluster will still be running and answering to requests, but it will not be able to afford losing another node.

From what you described I think that the safest solution is to add new master nodes in the new OS and cycle the older ones.

For example, add a new master, then cycle one old node, do this until all nodes are replaced.

But even with this approach you should use a maintenance window to afford some downtime.