IANAL, yada yada… I think the point is - if you are on trial, you simply decline to testify. The jury cannot infer anything from this, it’s pretty normal. Not every innocent man can sound innocent under the right type of questioning from the prosecution.
If you chose to testify, be prepared to to be cross-examined. If you refuse to answer be prepared to have that response interpreted however the jury or judge like.
(In an analogous type of case - the classic “tell me your password” case. Someone coming into the USA had their laptop checked by border guards. He logged in, they found kiddie porn, and they arrested him; his laptop got shut down. Later, they wanted him to fire up his laptop again, he refused. One of the arguments was his right to not incriminate himself. On that detail, the judge said that since the border guards had already seen the material in question, and he had shown them, he no longer had a right to refuse. They knew exactly what they were looking at, and having consented to display the evidence once, he could not refuse the next time. He waived his right when he showed the incriminating evidence the first time. )
So for the OP question - if you agree to testify for your defence lawyer, you cannot refuse to answer questions about the same matter from the prosecution. You waived your right when you took the stand. You maybe could plead the fifth on an unrelated topic, but the prosecutor cannot ask you about unrelated topics.
(L&O also teaches us about “opening the door” to a topic. Cross examination is exactly that. They can ask for more details about what the defence already asked. If the defence didn’t ask about X, prosecutor can’t bring it up. - perhaps a real lawyer can clarify these rules - Anyway, the judge gets to decide what’s relevant ot the case.)
Where the fifth is most relevant is for the witnesses, those testifying at congressional hearings, grand juries, etc. At a trial, only the defendant is on trial. A witness can’t be 'found guilty". SO if I am asked, at Fred’s trial “did you kill Joe?” I plead the fifth. If they then decide to charge me with Joe’s murder, they cannot mention at my trial that at another trial, or the grand jury, I plead the fifth or hat I answereddetail A but took the fifth on B. (They could, however, summon Fred to testify).
If someone does plead the fifth, one tactic is to offer immunity. They could offer me immunity to nail Fred, or vice versa - depending on who they believe and who they want to prosecute.
So the gangsters at the senate hearing took the fifth. If they had admitted they were running a racket, that (sworn) testimony could be used against them. If tehy lied and it could be proven (maybe by picking at the details) they could be charged. Their fifth can’t be used in any way. It’s not like the police did not know they were involved. The trick is still proving it without forcing their testimony - the whole point of the fifth.