My entire life I have been a pessimist, and prepared accordingly. That has lead to multiple bouts of depression and even some undiagnosed bi-polar where I can watch a comedy that has the morally good ending and I have to struggle from completely breaking down. Or hear a song that reminds me of one of deceased parents and makes me sob. I'm not in that place now, but I am not far from it ever. What have you done to help it?
Occasional bouts of depression are normal and what I've heard others refer to as: "ordinary misery". As long as you are able to eventually recognize them and you don't allow them to consume you, there's really no need to hit the panic button. Take a 'this too shall pass' attitude and you'll bounce back eventually.
If you really think you might be bi-polar though, you might want to seek out professional help for that.
Note that I'm not suggesting that I think you have a mental health disorder (you haven't come across that way on here to me) and I wouldn't have said to think about seeking out help if you hadn't said you sometimes feel you have undiagnosed bi-polar.
If it's to the point where you're questioning it though, might want to get it looked at?
That makes it sound like a good thing, and that is hard for me to accept.
I am certainly going through a "realizing I am going to die phase", and unfortunately I am taking the wrong approach by ignoring my surroundings and staying in my head. That leads to two things. Ignoring my responsibilities and pining for what is next. Funnily I had a conversation with one of my clients yesterday about this. Retired NYC Sergeant. Retired at 62, now 88. Started fishing with his one friend in Long Island Sound. Buddy got bored and went back to work. Started golfing with another retired friend. Buddy got bored and went back to work. Sat around for about 6 months getting fat, as he said, so he went back to work. Worked at a grocery store for 5 years and hated it by the end. Then he moved to Florida with his now retired wife and watched the world leave him behind. His wife died a few years ago and now he is just waiting to join her. That certainly didn't help my frame of mind because that is me. I can fish, but am no fisherman. I can golf, but am no golfer. In fact, I left all my hobbies at the door to this business when we bought it. Most of my friends too.
I think a lot of this is processing what's next. Both kids are out of the house and are still dependent on us, but that is less and less every year thankfully. And like you said, everything else is pretty much running smoothly. I have not been at a place where I just have to do the day to day for a really, really long time and I am terrified that it will crumble. Part of me wants it to start crumbling so I have something to work for. Is that bad?
After reading this, I instantly thought of this classic meme:
For what it's worth, I think that what you're struggling with is what, if each of us are lucky enough to get there, just about everyone on the planet eventually struggles with when they hit a certain age (and it's a different age for everyone.. some people never get there).
There's unfortunately no one 'right' way to tackle this stuff. Most 'experts' preach stability/routine, but that's so much easier said than done... especially as things that you had previously built your rock solid routine around (raising kids, working/contributing towards your career, supporting a spouse) start to exit stage left one after another, even if you adhere to each of them perfectly.
End of the day, my solution has been stoicism. You got two buckets: shit you can control and shit you have no control over. You need to focus all your energy in the former and figure out a way to release time and energy spent on the later.
Easier said than done though... and based on my posting history it's pretty easy to point out that I'm a shitty stoic, because all I do is question and pontificate over things I have zero control over.

I accept it though, and I do try to work on it and keep my hypervigilance tethered, as much as is possible, to the internet... and away from my actual life.
EDIT: After re-reading this, I'm not sure if any of this will help you sleep any better. My apologies if this was rambling nonsense.