Fair number of the CS PhD students I knew while I was there were not good coders, with professors being even worse at it. There's no incentive to write good code, just that it "functions".
I would always dread new teammates that were 100% academia with no industry experience or real project experience. More often than not if you leave them alone for a bit you come back to functions with several dozen one character parameters or something equally odd. Really uncertain why this is, but this has consistently happened multiple times and it's always this type of situation.