One factor is programming is all random people. There is really no Beyoncé or Taylor Swift of programming that everyone in the world knows.
A random developer saying “hey checkout this npm package I wrote to do XYZ” is something that could directly be useful to people in their own projects or in the future.
That is probably the point. A random post about programming from a random guy can be potentially useful for one's own projects in the future. So I can project myself in the project of someone else when reading HN (sorry my english is not good enough to express clearly what I mean).
This is probably less true for music, except if you are really really moved by a song, to the point it could change your life (this can happen a few times per decade or per year but not so often)...
A random developer saying “hey checkout this npm package I wrote to do XYZ” is something that could directly be useful to people in their own projects or in the future.