Haki was foreshadowed in skypiea and Alabasta
So?
The first real thing that actually was said to counter Logias, was the Yami Yami no Mi. But it had the drawback of taking more damage.
Couldn't BB just get Haki? Dude managed to put that scar on Shanks, Buggy said on that flashback that Teach didn't sleep at all for days. He is obviously something else.
Same way Doflamingo simply acquired the Mera Mera, he could just "acquire" de Gura Gura no Mi. Just some "I did all that to get Whitebeard killed and his fruit would reappear somewhere else and I would get it."
There are two scenarios.
Either Oda thought about Haki ahead and introduced all these minor appearances, or he decided to take these abilities that he used before, and make something out of them. Creating Haki.
It's kinda pointless to say "it was all calculated" when he created the Supernovas just to hype the Sabaody arc, and later decided to turn most of them into major players.