Once a code is added in a thesis or previous paper it may well get copied by default to the next paper from that group
Doesn't explains all the issues you've found, but it doesn't seem unlikely
As you say, it's very poor practice,
& it means we as readers can't tell what's actually happened