As Spockanort said, this was Riku's darkness given form in the dream realm, not the Replica.
There is no "immediately", you're missing that in between leaving Sora and Naminé behind, Repliku was found and then manipulated by Axel who used him for his own ends, including killing off Zexion.
Afterwards the Replica realized that the ways Axel "proposed" to make him his own person didn't work at all and he still felt empty, opting to try and see if he could get rid of it by defeating the "original" Riku.
By that time, Axel's manipulations had already overlayed the things Sora said to him beforehand in his head.
Now that's something I find to be really somewhat far-fetched. The Repliku may be a bit unhinged and rather forcefully looking for a purpose, but he's nowhere as twisted, ax-crazy and violent like Vanitas who hurts people just for the heck of it.
If I had to compare the Repliku with someone, I'd say he's a much more fierce and direct version of Xion.