There's so much to unpack here.

First of all if your experience is anything like mine was, the idea that you're choosing how to spend "the rest of your life" (and the pressure that comes with that idea), is the source of the paralysis. Life is both chaotic and a smorgasbord so I very much doubt that you'll be spending your entire life at one thing. Oh sure, some people do, but A) some people end up not being able to (because life is chaotic) and B) some people don't want to (and they don't have to, because life is a smorgasbord).

I was in group B and I've had from 3 to 5 careers (depending how you look at it), over the course of 30 years. I'm not saying that's better; but my point is, the "rest of your life?" Depending whether you're A or B: A) you should be so lucky, or B) that's a prison sentence. It's not what to do forever; it's what to do next. Humans are great at deciding what to do next.

Secondly, for this particular question, making any decision is probably more important than making the "right" decision. Or you could say it another way: There are no wrong decisions. We don't choose the right path; the path is wherever we walk. We make the path by walking. And even better, anything can lead to anything else. Especially if we're talking about working with computers, which are used in every field. But more broadly, everything prepares you for everything else, usually in ways you wouldn't anticipate. If what you do next puts you in a place that seems wrong, then in what you do next after that, you can change. But you won't know right from wrong until you get into it a little bit. I don't believe such things can be planned. "Theory" takes you only so far.

Third: How did I decide what problems to solve? I have always chosen to solve my own problems. Which is not as selfish as it sounds; any problem I happen to share with others, I am solving their problem too. And as it so happens, I actually have a lot in common with a lot of people, including having the same problems, so it works out to our mutual benefit. It's important to realize one is not some sort of weird randomly-generated freak, nor a "special unique snowflake" as they said in Fight Club (which I quote in my HN profile and which you should probably go watch or read). These two ideas about oneself are mirror images of each other, one negative, one positive, but both narcissistic as hell and ultimately self-defeating. You are like most people. Solve your own problems and you will solve a lot of people's problems.

Tangent: I learned that as a musician. (Speaking of weird unrelated careers.) When writing a song, I wrote what I liked, a.k.a. what I thought sounded good, a.k.a. what I wanted to hear. I wasn't sure how it would be received, but fuck it, at least I liked it. Well it turned out to be a big boost to my self-confidence and my trust in my own instincts, when I noticed that the more I liked something I wrote, the more popular it tended to be. It started to dawn on me that (as I said above) I have a lot in common with other people, and if I follow those instincts and make those particular decisions, I am representing a large cohort of other people who will approve of it. Sure there are those who won't agree. Let them find someone else to write songs for them then. Or write their own! (lazy-asses!)

Anyway applying that same idea to engineering and the solving of problems: My primary interest is in solving my own problems. It's inherently practical, because if a given problem is not one that I personally have, I won't have any hedonistic, selfish interest in it, thus I will be lacking that particular component of human drive, and either my work will suffer, or I will suffer; likely both. I'll be that much less motivated, and that much more likely to become discouraged in the face of setbacks, etc. etc. This is inherently a hedonistic argument - do what feels good. Things that feel good are natural and easy, and at least for the simpler pleasures, are usually based on having conferred some evolutionary advantage in the past. Reproduction being the only one that will trick you into propagating the species at the expense of your own more-modern interests, so beware of that one! But otherwise: you are drawn to things that feel good, for a reason. You were made to be the type of organism for which shit smells bad. Shit smells bad, not because it's shit, but because humans who liked the smell and taste of shit were quickly removed from the gene pool through starvation or disease. You should instead follow your instinct to eat food.

For the same hedonistic reasons, if your decision is, as you frame it, between that which you want to work on, and that which you should work on, what you want to work on wins every time. Every time. You can't sustain motivation based on a "should." All the philandering and molesting priests should convince you of that. A "want to" will help you surmount challenges and avoid getting sidetracked. (Unless, like me, you wanted to be sidetracked!) On the other hand, and speaking of sidetracking, a "want to," will likely change. That's OK. Don't let that tempt you toward a "should" though. A "should," you actually have no idea about and neither does anybody. Nobody knows what "should" happen or "should" be, always remember that. That's my take. But see, when a "should" is actually a "want to," then a should can be legit. Some people are motivated by the desire to serve; they live for shoulds. That is great. But they are still pursuing want-to's.

Ignore A and B from above for the following.
A.Dispose(); B.Dispose();

In high school I learned a little bit of A. My dad also did A. (It was his 2nd or 3rd career so I guess it runs in the family.)

But to be different from Dad, I pursued a degree in B.

But then I suffered a life trauma and ended up not pursuing a career in B.

Instead I did C, and experimented with A. Wasn't ready for A though, so stuck with C.

At some point I started doing D as a side thing too.

Eventually discovered E, liked it, did it for 7-8 years.

But it wasn't as lucrative as B. One day someone found out I knew B and said, jeez you could probably double your salary if you did B.
I suddenly said hey yeah money is nice (I had started to give a shit about it by then), so what about B?
Well I went back and revisited B. Made progress, but after 2 years, found I didn't actually like B all that much after all. At this point it had been 20 years since my first decision to do B, so yeah no wonder.

Tried C again, and started relying on D for the first time as a moneymaker.
Did all right with it but as soon as an opportunity arrived to do E again, I went back to E.
And realized, jeez I'm too old to enjoy C anymore, and D sucks as a career (it was better as a hobby). So I was glad to leave both.

Then through the E job, rediscovered a variation of A. Liked A a lot suddenly, because I was using it to solve my own problems, and solving the same problems for the people I worked with. That's where I am today.

A is programming. D is music. B, C and E are all different roles in the same industry, that shall remain nameless so nobody links my real identity with rdiddly and his more controversial comments on HN.

So arguably because B, C, and E are in the same industry, that might put the lie to my idea that "everything leads to everything else." But no, I was simply lazy and looking for cheap ways of (again) solving my own problems (in that case paying rent). With funding and time I still believe I could've gone to school for something totally different and transitioned to that, I just chose to make it easy on myself and transition to something more closely related. Also it so happened I was interested in that industry (as I was when I first chose B).

Anyway that's my take, good luck.