Extreme fast charging of batteries using thermal switching and self-heating