I’ve had this type of insomnia on and off over the last couple years. And yes, sometimes medication made it worse, but I do think it may have more to do with MAV and the stress that comes with it.
I took an affordable online insomnia course that helped me quite a bit:
I think also when you start stressing out about sleep, then it becomes a sort of problem where you associate the bed and sleep with frustration/sleep and it can become a viscious cycle. The program makes you log sleep and it made it very clear to me what my poor sleep triggers were. Not to say its all in your head, the mediation is probably the culprit, but treating yourself for insomnia can’t hurt.