The spousal immunity right is exercised by the defendant, not the person testifying. You can’t convict me through testimony of my wife, even if my wife is willing to do it.
Something like that can happen, but it’s not nearly as common as it is on television. A lawyer who makes a habit of that is risking a judicial ass chewing (or even worse, an appellate ass chewing). I can think of times I’ve seen somebody try to get something in they know full well is objectionable, though. I saw the punishment phase of a death penalty trial when I was a kid (literally, like mid teens) where a psychiartrist was testifiying for the state who was notorious for providing such testimony. When the prosecutors passed the witness, the very first question the defense attorney asked was “You’re referred to in the newspapers as “Doctor Death,” aren’t you?”, which caused the prosecutor to be on his feet objecting in a matter of seconds.