It's a risky option to take, as prosecutors will then ignore the immunity agreement and put you in jail anyway. I mean they tried that vs. Bill Cosby even though he had access to high priced lawyers. A regular person would have been screwed.
I think a lot of people have this idea of courts being highly technical and finding cases with precision, but in real life it's a lot more lazy and stupid people trying to avoid having to do work while still getting their job done. A great many miscarriages of justice come down to "the guy didn't want to do the work and lied about it, and nobody wanted to make the effort to verify what he said". There is a pervasive attitude of "that guy must be guilty, even if not this crime then of something, I'm not going to let him go over a mere lack of evidence. Society will be better with him behind bars."