"It started as a prototype, but got pushed into production"
All of the very worst systems I've worked with have an origination story that can be summed up by the 10 words above. If you hear these words, either run or go into legacy code mode.
Prototypes are dangerous. Dangerous in that they can easily go on way past the point of diminishing returns, and dangerous in the sense that there's too much temptation to put it into production. When you prototype, I think you need to decide right off the bat what the limited goal of the prototype is and set a timebox for the effort. There has to be an acknowledgement that we're temporarily coding without the safety regulator of good practices and plan on throwing away the prototype code later.
I said much more earlier at Of Spikes and Prototypes