Software needs regular refactoring just like cars need regular maintenance. It is very difficult to determine how much time and effort to spend working on making it extendible when you're writing it the first time (even the product owner might not know how it will be used initially) but after a few months in production and a few feature requests, you'll get a better idea of what the pain points are and will be in a much better position to refactor. The problem is convincing the people who cut the check to allow engineers the time to do it