the AP has no power to impose civic changes at all. the UN can do it, so i can see how you'd connect the two hitting on the same turn, but that can't be what happened. you can use spies to change somebody's civics, that's got to be it.
i've never had the AI change my civics, so i'm not sure what you see or how it gets implemented. i would expect a notification that an infiltrator had changed your civics. obviously i'm guessing, but you get a message that they destroyed a farm or sabotaged production or an existing building even when you don't catch them. it's easy to miss those tho.
did you keep checking whether you could change back, or expect a pop-up to appear when you were able to change back? i doubt there'd be a pop-up. there may well be a bug with changing back afterwards. when i change the AI's civics, they tend to not change back only 5 turns afterwards, they wait a little while longer. maybe they do that every time and i just haven't noticed. oh, maybe you can't change back after just 5 turns, you have to wait 5 turns + the time you would have been in anarchy if you'd made the change yourself, even tho a "spy-forced swap" is instant with no anarchy? would be weird tho, and extra harsh.
because you still have no way to change back, i suspect a bug with that spy-change thing. and that definitely would need looking into. but it's not an AP bug.
spies can also force the same sort of change for religion. it's like bribing in that you can only change someone into a civic/religion you're using yourself. if you're the victim, that can be a way to tell who did it i guess, if you didn't catch the culprit, by checking the info screen to see who's in those civics.
ps i'm not trying to be condescending. i'm just trying to explain what happened, and see if there is indeed a bug in that spy mechanic. plus maybe figure out how to find the culprit to get revenge!