I can't see anything in the rules that suggest that the offense (team A) would not be able to accept the penalty and retry.
There are specific rules that apply when both teams foul and there is a change of possession (11-3-3-6). Therefore, I presume that the rules for when only the defense (team B) fouls will apply in cases where there is and is not a change of possession.
From 11-3-3-4 (NFL Rulebook)
Item 4. Fouls by Team B. The following applies if there is a foul by
All fouls will result in the distance penalty being assessed on the
ensuing kickoff, unless Team A chooses to attempt a retry after
enforcement of the penalty, or the penalty negates a score by Team B.
If the foul results in a safety, Team A is awarded one point.
Note: If the foul is for defensive pass interference, and it is
declined, no distance penalty is enforced on the kickoff.