I think you have a good handle on the federal. I haven't run across the state issue (I advise my clients to pay $4K/yr. from non-529 plan funds just so we don't have to deal with allocations).
I was curious so I looked at the code of VA as an example (and something I'm familiar with). It just references IRC 529 for the definition of "qualified higher education expenses" (qhee).
That takes us to IRC "Section" 529, "Sub-section" (e), "Paragraph" (3)--and yes, I'm deliberately being verbose here since words matter:
The section of IRC that causes some qhee to be taxable income at the federal level is "Section" 529, "Sub-section" (c), "Paragraph" (3).
Note in "Sub-paragraph" (B):
"For purposes of this paragraph" [referring to 529(c)(3), not 529(e)(3)]
"The total amount of qualified higher education expenses with respect to an individual for the taxable year shall be reduced . . ."
So this tells you how to determine taxable income, not what constitutes a qhee. That definition is in a different paragraph. Had Congress wanted to modify the definition of qhee, they could have done so in Sub-section (e). They didn't do this, they just modified how you calculate what's included in gross income in Sub-section (c) and specifically limited this modification to one paragraph of tax code.
I'm not curious enough to research court cases but to me, in VA, this suggests that you don't have to recapture the VA deduction if the distributions were used to pay expenses that were federally allocated to AOTC/LLC.
Others may disagree with me, and they may be right. I would research it further before signing a return. I think it's worth looking at your state tax code to see what definitions they're using and under what conditions you have to recapture the deduction. I'm guessing they're not all going to be the same.