If it is scarf or specs, no it can't volt out. He has to choose volt switch if it doesn't not want to be traped and so I think it is easier to block it with an electric immunity.
Magnezone, even in gen 7, was used to trap steel pokemon, I have just added another mon to the list. So it's not...