I was lacking the Purple reference - you mean Woman From Tokyo (WFT)! That riff can very well be borrowed, Ritchie, who had been down with hepatitis, was running out of ideas when Purple's Who Do We Think We Are (the swan song of Mk II) was recorded, so he might have very well "remembered" a few riffs while he was recuperating with chicken soup, the only thing his body would accept at the time. I can hear the origins both in the Kinks middle eight and in Cream's number, Blackmore just altered the rhythm of the riff. He always considered WFT a bit of a throwaway number and it was never played live with the laid back orchestral part in the middle (one of the best parts of the song) while he was still in the band. (He did mention once that WFT is one of his few riffs in a major key and that he finds it difficult to write in major, being naturally attracted more to minor keys - Purple were generally a minorish band when Ritchie was still around, that all changed under both Bolin and Morse who as Americans were less major key-averse.)
A lot of Ritchie's riffs were borrowed and he's never made no bones to hide that, YouTube is awash with his selfdeprecating comments on where he "loaned", "borrowed" or "stole" riffs.
He says he got the Black Night riff from Rick Nelson,
but I think The Blues Magoos might have refreshed his memory a few years before Black Night was hastily recorded (and produced) at a very drunken session in the wake of the In Rock recordings because the record company did "not hear a single" among the In Rock tracks. It was supposed to be a rock dance number, hence the handclaps and the tambourine added to the snare beat.
Back to Woman From Tokyo: The recording of Who Do We Think We Are was fraught with strife, Blackmore hated Gillan's increasingly outlandish vocal melodies so much, he refused release of this number (with a riff not entirely dissimilar to Woman From Tokyo) from the sessions, it only saw the light of day years later (and against his will).
I liked it actually, but by that time Blackmore was looking for a bluesier and more conventional singer in the Paul Rodgers vein (Gillan always liked to constuct vocal melodies that defied expectations) ... enter David Coverdale! And some people even say the WFT riff was recycled by the new Mk III line-up once again, this time carried by the organ!