The regulatory bodies are reluctant in defining a regulation for that. Because there are first officers who do not hold an Airline Transport Pilot License. The airlines would need to add an extra flight member for that rare situation.
Instead, it's up to each airline's SOP when it comes to Crew Resource Management. There are various assertiveness training models, of which are PACE, and CUS.
Facing battery depletion following an electrical failure, here's an example for what the last step of PACE could have been like on October 11, 1983:
Captain, if you don't immediately reverse course and get back to night VFR conditions, I must take over control of the airplane. I cannot allow you to subject the passengers to such an unnecessary and high risk of certain death. Under these conditions, it is my duty and responsibility to relieve you of your command. (To Intervene or Not to Intervene? The Co-pilot's Catch 22)
Or, it can be much shorter when there's no time, such as asserting, "I have control," and pressing the TO/GA to initiate a go-around, for example.
Some airlines use only two steps, i.e., "I've mentioned my concern once, this will be the second and final time, else I'm taking command."