I don’t see how granting immunity makes it okay to compel testimony. Tghe Constitution doesn’t say anything about immunity, just that one can’t be compelled to testify to something that might be detrimental to him.
Granting immunity does not make it OK to compel testimony.
A prosecutor can not grant someone immunity and then force them to testify. And they don’t do that.
However, if the person agrees to testify, the prosecutor can grant them immunity.
The key is that it is not compelled testimony. No one is ever under threat of being prosecuted for not giving testimony against themselves. They are under threat of being prosecuted for other actions.
Immunity makes it OK to compose testimony... for the immunized party.