I'm an economist not a programmer, but shouldn't the goal of programming be to write code that other people value? Also, you do need other people to program, the people who build the hardware, operate the power system, grow your food..., it's just that with extremely high probability you can count on them being there for you.
You can program to solve your own problems. It's very likely that other people have similar or identical problems, so your code can benefit them even if you didn't plan for that.
Programming is quite a remarkable activity: