I've often seen it argued that if only the Germans had realized in 1918 that they were about to get a big influx of troops from the east they would have avoided antagonizing the Americans and finally won the war.
First off, is this judgement generally accepted among historians of the war, or do some argue it would have remained a standstill?
More importantly, if this was perhaps the case, why didn't the Germans just seek an immediate peace deal with the Russians after the provisional government was established? Was this debated in the high command?
I'm not certain about Kerensky, but Lenin obviously gave away just about everything they asked for to eventually get a deal. Why not agree to something with more generous or fair terms to get it done two years quicker, so you can focus on the west and gain a bigger prize?
With France and England subdued they could have focused on the east later if they wanted, after they had time to rebuild. It would just seem like the obvious rational policy to me.
The main reason would be that the Provisional Government committed itself to continuing the war, so it is unlikely to have accepted any peace overtures even if the country was increasingly war-weary and its military shaky.
There's also the issue that throughout the war, the Germans themselves could never really agree on what peace terms they would demand or draft terms that would ever be acceptable to their still undefeated enemies, and as the war went on, peace aims (on both sides) became more and more 'extreme' so making them even less likely to be acceptable. As the Germans took more territory through 1915, the ideas started to shift towards breaking off the western parts of the Russian empire into client states and German territory.
The Germans had made some attempts at a deal with Russia before the end of the 1916, but they were unsuccessful and the Russians had made clear they were not interested in a separate peace. German plans started to shift towards creating some kind of semi-independent Poland and retaining the Ober Ost (basically the bits of Lithuania, Latvia, and Belarus they controlled) in some way. Terms along those lines were unlikely to be acceptable for the Russians.
Another issue is the domestic German situation. With the rise of the Third OHL of Hindenburg and Ludendorff, Germany had essentially become a military dictatorship. These men saw only military solutions to their problems and were unlikely to be magnanimous enough to their enemies to secure any peace. They went through with the lifting of restrictions of submarine warfare knowing full well the most likely result and against the advice of German diplomats.
You mention Lenin (and assumedly the Treaty of Brest-Litovsk), but remember that was in a situation where the Russian armies had essentially dissolved and the Germans and Austro-Hungarians could advance at well (and Lenin gave them what they basically already had). The Provisional Government's armies still ostensibly held a front, why would they make such terms?
In terms of peace deals, it's important to remember that with the sacrifices involved, all parties focused on ending the threats that faced them. Any peace would either result from the utter exhaustion of all parties and so their inability to actually achieve the aims they wanted, or one side losing. As long as it seemed possible to win, there wasn't a great deal of incentive to negotiate some small peace deal.
Soutou, G. (2014). Diplomacy. In J. Winter (Ed.), The Cambridge History of the First World War (The Cambridge History of the First World War, pp. 495-541)
Afflerbach, H. (2014). The Eastern Front. In J. Winter (Ed.), The Cambridge History of the First World War (The Cambridge History of the First World War, pp. 234-265)