He actually is on trial --- technically (escalations and "security situations" tend to happen whenever he's due to testify). But yes, conventional wisdom is that this may play a part.
I don't think this is quite the whole story, though. Both Netanyahu and many of his coalition partners are also simply ideologically committed to the idea of a greater Israel, i.e. including the occupied Palestinian territories.
Yes, Netanyahu in the past at times presented a more neoliberal centrist face (he is a master at political survival) --- but it's worth remembering that he grew up in a deeply revisionist Zionist (basically, the version of zionism that favours territorial maximalism and expansionism) and has voiced his desire to expand and expel the Palestinians for a long, long time.
The following is an extract from Max Hastings' book "Going to the Wars" about him meeting a young Netanyahu back in the 1970s (Hastings would have been writing a book about Netanyahu's deceased brother Yoni at the time, which Benjamin and his father Benzion sought to basically make a hagiography):
"At Bibi Netanyahu's dinner table in Jerusalem, I listened with crawling dismay to Bibi talking about the future of his country. 'In the next war, if we do it right we'll have a chance to get all the Arabs out,' he said. 'We can clear the West Bank, sort out Jerusalem. He joked about the Golani Brigade, the Israeli infantry force in which so many men were North African or Yemenite Jews. "They're okay as long as they're led by white officers.' He grinned." [note also: the casual racism / white supremacy; you can also read some of Hastings on meeting a young Netanyahu here for free: https://www.theguardian.com/commentisfree/2009/may/09/israel-middle-east-max-hastings]
Basically, to some extent they may also simply believe that they have a unique, historic opportunity and the momentum to realise long-held aspirations. Once the war stops, as they see it, that will vanish.