This is "begging the question." You are working back from your beliefs to justify yourself.
The fact is, the Warwick Line was much stronger, both in terms of manpower and its' physical state, than you allow for. As Barnard observed, the fortifications were "essentially completed" and the further work was primarily auxiliaries. He stated that the idea of "an assault was mere hare-brained folly." The line was a strong, and uninterupted series of fortifications manned by a relatively strong force as of the 5th. You seize on his acknowledgement that it was not completely impossible that an assault would not succeed, merely incredibly unlikely, but then ignore the fact that because the Federal Army was on the march, it simply wasn't concentrated to make a major assault, as Barnard and other noted.
A quick assault "breaking the line" would have been a long-shot. Indeed, something neither Grant nor Sherman, both supposedly successful generals, ever achieved. However, if the incredibly unlikely event occurred, and the Warwick Line was breached, then Magruder intended to leave a garrison in Yorktown, because it was the militarily correct thing to do. Keeping possession of Yorktown denies the Federals the use of the York River. This, in turn, prevents an advance up the Peninsula because supply wagons have a finite range. Thus, in exchange for a few thousand men (which might be rescued), the entire Federal Army can be halted for a month or so.