I think you're reading it wrong. It doesn't grant immunity for perjury committed while testifying under immunity, which is a completely reasonable exception. Without it, a guilty criminal would have no incentive not to give false testimony portraying his guilty friends as innocent.
You might want read this: https://scholarship.law.marquette.edu/cgi/viewcontent.cgi?re...
> Again, this violates the 5th amendment.
That's your opinion, but the Supreme Court's opinion differs: