Look into the science of motivation, it's very enlightening. Specifically, the difference between intrinsic and extrinsic motivation.

In brief: intrinsic motivation is when you're motivated for no "reason". You're intrinsically motivated to play video games, for example. You don't have to reward or punish yourself to get yourself to play a video game, you do it because you want to.

Extrinsic motivations are things you need a reason to do. Money is an extrinsic motivation: people probably don't want to build the next ad delivery service posing as a communications platform, but they do it for the money.

In a world full of unicorns and rainbows, we would all do jobs that intrinsically motivate us, but in the real world, there's not much reason to pay people to do things they're intrinsically motivated to do, because they're going to do those things whether you pay them or not. So the reality is that most people have a hard time motivating themselves to do their jobs, because what makes a job pay at all is that it's not easy to find motivation for it.

The remainder of this post moves from established psychology into my personal opinion:

A lot of what I see is that money and greed can turn intrinsically motivated tasks into extrinsically motivated ones, turning something that was enjoyable into something that is miserable. If you had to play your favorite video game in a way specified by a boss for 40 hours a week, you would probably no longer be intrinsically motivated to play that video game. For a lot of us, programming was like that: we started off loving programming. Programs were like puzzles, and when you solved the puzzle the program would compile and do something. But the day to day problems of a programming career are mostly ones where you're solving some inane detail of a larger whole, and even if you are lucky enough to care about the big picture, you probably don't care about implementing yet another responsive XML cloud-based enterprise SEO keyword. If you are qualified for your job, you mostly have a pretty good idea of the solution to the puzzle, so it's not fun to solve. As Quincy Jones said, "If you go into the studio to make money, God leaves the room."

And a lot of us have a hard time adjusting to this once we turn programming from a hobby into a career (which is how most of us got here). We keep working, thinking we'll somehow recapture how it felt to program when we were tinkering with HyperCard on a 1980 Apple, but it never happens because the whole structure of what we're doing has changed.

There's nothing wrong with you. The problem isn't you, it's the structure that economic leaders to build an economy that forces people to work toward the economic leaders' goals rather than their own goals. To quote Joe The Barbarian, "It's not the picture that's upside down, it's the world."

I don't have a good solution to this problem. I love programming when I do it for myself, and I've spent countless hours writing compilers/interpreters without reaping a dime from it (okay, I guess I've gotten jobs due to people being impressed by my compilers/interpreters, but the economic payoff is negligible compared to the effort). The best I have come up with is to opt out of the economy as much as possible, and find ways to work fewer hours while making enough money to do what I want. The best I can do is minimize the time I'm wasting on extrinsically motivated tasks.