As a director of a software development organization, I won't be popular for saying this. But... it is your boss' fault. Not yours.
You simply aren't motivated. I want to slap the person somewhere in another post who said... "motivation comes from within". It *rarely* comes from within.
When one of my managers or peers comes to me and complains about "unfocused" or "unmotivated" employees, I tell them to get off their collective ass and motivate their team or their employee. Psychologically, as an employee, you should feel driven by your surroundings to achieve a goal. That feeling should be driven by your team, your boss, your organization.
Being "self-motivated" is the single, biggest path to burnout in existence. Don't even begin to blame yourself.
Here is what I would recommend. Go to your manager. Tell your manager that you simply aren't feeling very motivated about the work you are doing. Have an open and honest conversation about it. You might be surprised. Your boss might actually bring some out some of the motivational mojo that you need. If your boss doesn't come through for you, then think about going to another organization.
But don't quit programming. You probably love it and you probably are pretty decent at it. You just need to be motivated, that's all.