I think it's generally fair to assume that you don't become a Stanford CS professor by being bad at writing code and creating abstractions, and that the average professor (let alone one at a prestigious university) is more knowledgable than your average HN commentor
Professors have no reputation for writing good code. Academic code is fairly notorious for being under abstracted, hard to follow, messy, etc.
If a passerby told me this story I’d have the same guess though!