There actually is a hadith in which in retreat from some lost battle Mohammed calls upon his followers to devote themselves to repentance and internal spiritual struggle, saying something to the effect that they are leaving the “lesser jihad” for the “greater jihad”. The problem is, essentially every fiqh (school of Islamic jurisprudence) regards this hadith a unreliable and discounts the sentiment expressed in it.
What I read was the notion of jihad as an inner struggle was first proposed by a cleric a few hundred years ago. Muslims are commanded to engage in jihad, but as Islam grew to take more territory, millions of Muslims lived their entire lives without coming within a thousand miles of any infidel lands. So how could they participate in jihad? He proposed the inner struggle as a substitute form of jihad.
The largest Islamic university is in Cairo, and they have codified Sharia into a book. About 50 pages deal with jihad as warfare. About a half a page deals with jihad as an internal struggle.