Ok, so you are saying that, since people in general like to do fun things, it takes a lot of self discipline to make yourself learn programming, history, etc, which in general requires doing things that aren't fun. I think you are overlooking something however: people don't just like to do fun things, they also like to make things that are cool (maybe not all people but this is very common in my estimation). And making things that are cool often requires doing boring work and learning boring things, even though the end result is not boring. I find this can be a very powerful source of motivation, so it actually might not take so much discipline as you think.
I would even speculate that how interesting / boring you find something is not static, but that otherwise boring things can start to seem interesting once it's clear that they are relevant to something you want to achieve.
Personally I learnt math mostly from self-study, and I've learnt it well enough that I now have published research (see [1], also [2] is in review and has been recommended for acceptance with revisions by the referee), have been invited to give talks about my research [3][4][5], and have stayed for a few months as a visiting researcher at University of Muenster [6]. I don't consider myself as having a lot of self-discipline; I have a tendency to hit the snooze button many times, to overeat, to let my room get messy, etc. But once I have an idea, I want to flesh it out and share it with other people, which motivates me to do the things that are necessary for this, which are sometimes boring.
[1] http://content.algebraicgeometry.nl/2017-2/2017-2-007.pdf
[2] https://arxiv.org/abs/1612.07306
[3] https://www.uni-muenster.de/FB10srvi/HotNews/show_artikel.ph...
[4] http://www2.math.binghamton.edu/p/seminars/arit/arit_spring2...
[5] http://www2.math.binghamton.edu/p/seminars/arit/arit_fall201...
[6] https://web.archive.org/web/20170121000748/https://wwwmath.u...