I think it's often genuine excitement to share a thing - without quite processing that anybody with the same idea can now build it (for simple- to mid-complexity projects).
KG: Anybody coulda wrote it, anybody coulda done that, one song, just one note
JB: Yeah but guess who did write it, me!
KG: Yeah but did you write this?
JB: Dude, I did, I told you to do the bendy every once in a while!
This is the part I don't understand. It's like sharing a finger painting half the time. Yes, cool, but so what?
[Edit: no need for the downvote, folks, it was an honest question although it seemed otherwise. I think the answers below make sense.]
I also think it is often momentum from “do you have a GitHub” questions you see in hiring.
There are many people who code to make cool stuff and enjoy sharing, but there is even more people who code to look good on CV.
I’m not trying to be mean, this is just an anecdote I had from my time hiring.