It is best to first sort out as best you can what you are trying to say. Why is the answer correct?

When I read 'essentially in theory', I suspect the author has grabbed some words that sound right and tacked them on to their statement that 'the answer is correct'.

If I read 'Essentially the answer is correct' I presume the author means they believe the answer is correct, despite complications.
If I read 'In theory the answer is correct' I presume the author believes the answer may not be correct in actual practice, though theory says otherwise.

Why are you qualifying the statement 'The answer is correct'? What more is there about the answer that you need to convey?

Assuming you mean to qualify the 'yes' both because there are complications and because the theory may not actually apply, you would need to insert a comma after essentially and omit the comma after theory or (much better) rephrase to something like Essentially, the theory would say yes here. At present, in theory only qualifies essentially, which would probably mean that the answer could only be made to be yes by careful manipulation.

Both essentially and in theory are hedges.Hedges are parenthetical words or phrases that modify the meaning of a sentence.
Essentially, they're handwaving, used to cover one's ignorance or unwillingness to give details.

Every hedge is different, and marks a different kind of estimate of the truth. In this case

essentially means that the sentence is simplified and represents a prototype or aphorism,
rather than an accurate depiction. It marks a summary judgement on the part of the speaker.

in theory means that the sentence is only hypothetically true, and is not known to be true in practice, or perhaps even known not to be true in practice.

It is somewhat unusual and self-defeating to use them both together. Using two hedges always produces much more than twice the doubt about the sentence, and these hedges are somewhat contradictory, as well. If the intent of the speaker is to convince anyone, this is not perhaps the ideal construction to use.