In either World Wars were most military leaders generally veterans that started at much lower ranks or even foot soldiers and rose through the ranks like other military leaders in history or were they wealthy educated elites that new the right people and started near the top? Examples or sources would be helpful.
To answer for the British Army of the First World War:
Firstly, we must define "start near the top". While nearly all armies have a system of Direct Entry in which recruits go straight into officer training, men doing this have always passed out of training having commissioned as Lieutenants. Not even in the days of purchase, no one went straight to General. British Generals of the First World War had decades of service behind them when they first took to the front, so for a given measure of "lower ranks", yes, they were veterans who rose from much lower ranks.
British officers were (and still are, do a degree) overwhelmingly public school boys and university graduates. A number of them entered service through the Junior Training Corps at school (which today is the Combined Cadet Force) or through the Officers' Training Corps at university. These both had the right to nominate a certain number of boys to Sandhurst without further examination, though after that, every officer cadets, regardless of background, had to undergo the same officer training. So, for a given measure of "wealthy educated elite who knew the right people", they were. However, it's notable that very few of the British Army's Generals of the First World War were actually titled, even late in their service: Field Marshal Sir Douglas Haig was of middle class background, and his father had been a prosperous but alcoholic whisky distiller. Field Marshal Sir John French had an unremarkable upbringing in Kent. Though he's quite an outlier, the most remarkable example must be the Chief of the Imperial General Staff, Field Marshal Sir Wully Robertson, who remains the only man to have risen from Private to Field Marshal in the British Army.
All these men had veteran service under their belts: Douglas Haig had led cavalry from the front in the Mahdist War in the Sudan (and even personally saved the life of one of the Egyptian troops under his command), and in the Boer War in South Africa. Horace Smith-Dorrien, who led the BEF's II Corps at the Battle of Mons, was one of the few British survivors of the Battle of Isandlwana.
So to conclude, the picture is rather more mixed than your question indicates. Were they wealthy, educate elites? Yes. Did they know the right people? To a degree they did. Did they start near the top? No, they all followed the same programme of officer training. Were they veterans? Indisputably.
Sources:
Gordon Corrigan, Mud, Blood and Poppycock