Good morning, ma'am,
Dyspareunia is the general term used to describe pain during sexual relations. It can have several causes.
I have not found a reliable reference that deals with this kind of symptom after stopping contraception, but considering that you felt this at about the same time, it is not impossible.
It may take a few weeks to return to a 'normal' menstrual cycle and there are many possible symptoms.
I am reassured that the discomfort does not usually persist, but if you report that it has been 2-3 weeks, to monitor the situation and consult, if only as a precaution, if the situation persists for 1 month.
I believe that activities that may cause or worsen this type of pain should be avoided until it is completely healed, such as more intense or vigorous intercourse.
For intercourse, use a water-based lubricant such as KY before and during intercourse as needed if you have not already done so.
I will be available if you have any further questions!
Tom Samaha, pharmacist