The point is that scientists don't need to publish certain things, one of them being the source code that helped them discover their findings.
Shell scripts and database migrations aren't super interesting, but you would want them if you needed to replicate results. I'm not saying they're interesting as published research, but neither is that random piece of scratch paper you used while trying to understand what is going on in some biological process.
It seems like the problem is that non-scientists don't understand the way science happens, and that often the source code isn't something that you would include in an academic journal.
Should science be done differently? Maybe. But that discussion is different than "why wont they publish their source?"
Maybe there is a barrier to adoption in the form of git. A more polished version of Gist - marketed to scientists and researchers - would increase uptake.
Why don't we publish our code? Do you publish one-off shell scripts or database migration code? The only important code is already open source or is (unfortunately) commercial in nature.