[subject] + 宁愿 + [option taken],也 + 不 + [option refused]
[subject] + 宁愿 + [cost accepted],也要 + [goal]
[subject] + 宁愿 + [verb phrase]
宁愿 introduces the option you would choose even though it has a cost. 也不 then names the option you refuse. Both halves usually describe something less than ideal, and 宁愿 marks the lesser evil.
With 也要 the second clause is what you are determined to get, and the 宁愿 clause is the price you'll pay for it.
宁愿 also works without a second clause, when the alternative is already clear from context.
宁可 means the same and takes the same frames. 宁愿 has 愿 "be willing" in it and leans toward personal wishes; 宁可 is a little more common in writing.
The option you accept goes after 宁愿; the one you refuse goes after 也不. Learners often put the rejected option first, as in English "rather than X, I'll Y".
The 不 after 也 carries the refusal. Without it the sentence says you'll do both.