I recognise myself in this (except that I don’t have a diagnosis or medication). However, for me it’s a certain kind of boredom that’s painful. I like reading, running, sitting and thinking, and similar activities which might not be very intense. But at work, routine tasks or even technically interesting tasks which aren’t urgent in some way can feel painfully boring to me.
The most successful moments in my career have been when I have been at a place long enough to know the domain and being reasonably comfortable in the code base. Because then I have been able to take on those really difficult and urgent tasks. And I don’t get nervous or stressed while doing it :)