In Elizabeth Pryor's biography of Robert E Lee, READING THE MAN, she writes that Lee worked closely with Winfield Scott during the Mexican War and greatly impressed Scott with his military talents. Their frequent collaborations in Mexico led Scott to call Lee, "The very best soldier I ever saw in the field."
Furthermore, during a quarrel between officers in Mexico, Lee publicly stood up for Scott during the court of inquiry, which, as Pryor wrote, "prov[ed] to the old general that he was a man of loyalty as well as bravery, and probably seal[ed] the 'almost idolatrous fancy' Scott reportedly had for him." (I'm in Google books and can't figure out the page number).
In this article (
https://www.americanheritage.com/robert-e-lees-severest-struggle#2) Pryor writes:
"Before Lee returned from Texas on March 1, 1861, Virginia had already held a secession convention and the pro-South faction had failed to win the day.
On arrival in Washington, Lee found the capital nervously preparing for the Lincoln administration. In theory Lee had been recalled to sit on a board revising the army’s regulations, but Lee and others were aware that he was being considered for higher responsibility. Lincoln was starting to assemble his military machine, making appointments and reassigning troops. Lee’s capabilities—and his allegiance—were among those under discussion. An aide to Simon Cameron, the new secretary of war, recalled a meeting at which Cameron asked General Winfield Scott if he had confidence in Lee’s loyalty. 'Entire confidence, sir,' was Scott’s typically booming reply. 'He is true as steel, sir, true as steel!' A week later, on March 28, Lee received news that Lincoln had promoted him to full colonel of the 1st Regiment of Cavalry—a coveted position. Lee accepted, once more swearing allegiance to the Union."
As for the offering of command, Pryor writes that on April 17, the day Virginia voted to secede, Robert E Lee's cousin Phillips Lee worried that Robert might go with Virginia and so told the War Department to act quickly. From READING THE MAN:
"The next day [April 18] a note was dispatched to Arlington, calling Lee to the officers of Francis Preston Blair, one of Lincoln's closest advisers, along with another message that requested his presence in General Scott's headquarters. At the meeting with Blair, Lee was told that Lincoln intended to offer him command of the forces being called upon to defend the Union. The two talked for a long time, Blair 'very wily and keen,' playing on Lee's sense of responsibility and ambition. Lee declined on the spot. He saw nothing but 'anarchy & ruin' in secession, he told Blair, yet he could not bring himself to raise his sword against his Virginia home and heritage. From Blair's office Lee marched straight to see Scott, in such agitation that he dispensed with his usual courtesies and insisted on being admitted to the general's office. Lee and Scott, bound for so long in mutual admiration, talked candidly for several hours. What can be pieced together from the available accounts is that Scott tried to persuade Lee that any forces amassed by the Union would be so vast they would stifle the South's will to rebel, making offensive action unnecessary. When Lee said he was convinced aggression was inevitable, and he could not lead an invasion of the South, Scott brusquely rejoined: 'If you propose to resign it is proper that you should do so at once; your present attitude is equivocal.' Now there was nothing left to say. A journalist was told the two men stood grasping each other's hands, 'too full of feeling to find utterance for one word....'"
In 1871 Francis Blair wrote (
https://encyclopediavirginia.org/entries/statement-by-francis-preston-blair-april-14-1871/) -
“The matter was talked over by President Lincoln and myself for some hours on two or three different occasions. Secretary Cameron and myself talked some hours on the same subject. The President and Secretary Cameron expressed themselves as anxious to give the command of our army to Robert E. Lee."
So in summation, Lee greatly impressed General Scott in Mexico. Scott spoke highly of Lee to anyone who would listen, which made Lee the natural choice when Lincoln and Secretary of War Simon Cameron were looking for a man to lead their new army.
Perhaps someone else can speak to how many heads were passed over in offering Lee the command and how those heads felt about the slight.....
Another article by Pryor:
https://opinionator.blogs.nytimes.com/2011/04/19/the-general-in-his-study