So I thought it might be useful to use maps to shape the discussion here, and show why McClellan retreated after each of the Seven Days battles in which that happened.
I will for now ignore Oak Grove, Garnetts Hill and Golding's Farm, as they'll be covered later.
First we have Mechanicsville. In the battle of Mechanicsville the Union troops were dug in a little to the east of Mechanicsville itself, along a creek (Beaver Dam Creek). There were four bridges that the Confederate troops inside Richmond could use to sally, which are numbered 1 to 4 on this diagram.
View attachment 300650
Bridges 1 and 2 are crossings directly into Union troop positions and are not possible for them, but they're not possible because of where the Union troops are deployed.
Bridge 3, the Mechanicsville Bridge, is covered by Union guns (and can be easily reached by troops in Mechanicsvile) so it's not possible to mount a major movement over it.
Bridge 4, the Meadow Bridge, is too far away from the Union positions to be covered. It's the bridge which is used by the Confederate troops to mount the Battle of Mechanicsville, and they run into Beaver Dam Creek and suffer badly.
But there's also another route, and that's marked here as 5. That turns the entire Union defensive position at Mechanicsville (McClellan couldn't cover Tolopatamoy Creek as well because he didn't have the troops for it) and Jackson takes it. At this point the choice is to retreat or have that entire force turned and cut off, as at this point the Union troops holding the line north of the river are opposite Confederate positions - they need to fall back to Gaines Mill (near the Union-controlled bridges).
The second battle is Gaines Mill. This was a Union tactical defeat, but even had it been a victory McClellan would have needed to react in some way, and here's why:
View attachment 300652
On the far right of the map is White House Landing, the Union supply base on the Pamunkey river. As you can see troops from Jackson's flanking force are making their way towards it, and even if they don't take White House Landing they can still cut the railway line.
It's possible if the line had held north of the river that an action could have been mounted to regain the supply line, but once the line broke it was impossible - to do so would have meant an assault crossing of the Chickahominy river against a massive Confederate force of sixteen brigades (Longstreet, DH Hill and AP Hill) plus the elements of Jackson's nine-brigade force not going after the supply line itself.
With the supply line gone, McClellan now has to set up a new supply line from the James river instead. He had a discussion with his corps commanders, who all agreed that rather than remaining in place until a new supply line was set up he should move south of the White Oak and stretch his left flank to the James.
Savage's Station happens next, and it's a rearguard action - Sumner is the army rearguard while the rest falls back. To turn around and stop retreating because the rearguard action was "inconclusive" is foolish.
Next up is Glendale, and for this I'm using one of 67th's maps rather than my own:
View attachment 300656
This is actually a pretty long battle line. As you can see the Union army has stretched out its flank to reach the James, and specifically to reach the Malvern Hill area to cover the new supply point. There's an argument going on with the Navy about whether the supply ships will be unloading at Haxhall's Landing (McClellan) or Harrisons Landing (further downriver, compromise) or a very long way further downriver at the mouth of the Chickahominy, but the Glendale position is where McClellan has retreated to by the 30th of June and it's the line he intends to hold.
Unfortunately, on the night of the 30th Franklin quit his position without orders. With the line so long and stretched out this left a gap, and the result was a kind of mad scramble for a defensible position at Malvern Hill (which was already the left of the line). Malvern is a great bastion but it's no good as an isolated position, because it has no protected supply unloading point in and of itself.
For why McClellan retreated after Malvern Hill we need one more map, and that's the map showing Lee's plan. Lee did not actually intend to attack head-on at Malvern:
View attachment 300654
His plan, as can be seen, was to envelop Malvern with the use of Longstreet. Magruder was not intended to attack, and possibly didn't initially intend to himself.
With the Navy refusing to escort transports any further upriver than City Point on the James (where there were batteries), McClellan needs to have contact with Harrisons Landing for his supply base. To hold a line containing both Malvern Hill and Harrisons Landing is basically not doable, the army would be too stretched, and so after the battle ends at dark on the 1st McClellan chooses to retreat overnight to Harrisons Landing.
It's only once back there that he's finally in supply; if McClellan had attacked on the 2nd it would have been with hungry troops, some of whom haven't eaten for days and who have empty cartridge pouches, against troops who've had the night to recover and stiffened by a number of brigades who didn't assault at all on the 1st.
Now, I said I'd get back to Oak Grove, Garnetts Hill and Goldings Farm, and here's why - those are the battles of the Seven Days where McClellan is attacking. They're also
first, and they're south of the Chickahominy and launched while he's still in supply.
McClellan's intent with these battles is to take high ground to set up his heavy artillery, and to use that heavy artillery to blast his way through the Richmond defences - neutralize the artillery in the defensive embrasures, then suppress the infantry while his own infantry move up for an assault. This is the only way to actually take Richmond itself without a proper, surround-them-and-starve-them-out siege, and it takes a certain number of troops - which mean that McClellan doesn't have the troops available to hold Tolopatamoy Creek.
You may ask why he's in such a vulnerable position, and the answer is that his supply point at White House Landing on the Pamunkey is one he's been ordered to take up. With the supply point on the Pamunkey it's the only option that allows one to attack Richmond with the available forces, and with the supply base on the Pamunkey the only way to have Richmond under attack without the Seven Days inevitably following whenever Jackson is called down is to give McClellan some extra troops to cover the Tolopatamoy. Not at all coincidentally, McClellan had been promised those reinforcements back in May and had been waiting a month in vain for them.