What's ironic about it is that about 1/2 the time developers correctly anticipate the general shape of the upcoming problem but it comes in a way they didn't expect thus they'd have done better by assuming it was never going to happen and dealing with it when it does.
This is a subtle distinction most people don't get.
I don't view it as a software development issue per se. Humans are just bad at predicting the future, bad at knowing how bad we are and bad at recognizing when we've been bad at it.
Trying to build a REST API coz the customer will definitely want it some day and thinking you've got a system at the slots in Vegas are two sides of the same coin.
And, I've learned the hard way that if a developer has got the same confidence that a granny at the slot machines has, preaching YAGNI isnt going to convince them they're wrong.