I think part of it too is that it's exploratory. Sometimes I use javascript to write music and as creative twists and turns happen the code folds in on itself in ugly ways that don't happen when solving a clearer problem
Compounded by the fact that in science once you have the result the code is probably just an artifact so there's no real reason to refactor it