[subject] + 宁可 + [A],也不 + [B]
[subject] + 宁可 + [A],也要 + [B]
宁可 introduces the option the speaker is willing to put up with, even though it is unpleasant. The second clause, after 也不, names what they refuse to do.
A, after 宁可, is the sacrifice. B, after 也不, is what matters more to avoid.
With 也要, the second clause names something the speaker will do whatever it costs: "even if it means A, I'll B".
宁愿 means the same as 宁可 and is a little more spoken.
English "rather A than B" puts both in one clause. Chinese keeps two clauses, with 也 in the second.
与其…不如 also compares two options, but in the other order: the rejected one first. It has its own point.