If you are a big corporation and can afford more resources, I guess it pays off to think about code quality from the start.
If you are doing some project for fun or as a POC, it doesn't pay much to spend time on writing quality code.
I think that writing modular code is paramount. That way you can replace it little by little if needed.