Read this when I was in primary school in Sydney, Australia, early 2010s. It was probably a small chapterbook with some pictures. I'm pretty sure the author is Australian but I'm not sure if it was in something like Aussie Bites, a compilation of australian children's books
Story starts with a boy being cruel to bugs: drowning, crushing, establishing he's bad. He wakes up tiny on a lilypad being rowed to bug court for his bug cruelty. At bug court he meets his lawyer, a Christmas beetle wearing a suit. I'm 80% sure his name was Frank but his name definitely started with an F. He was the only lawyer in the bug world willing to defend a human, and he never won a case. Frank tries to appeal to the judge but rules the boy guilty, and bug guards pull him away to the Honeycomb - bug jail. He wakes up and realises its all a dream, and decides he will be nicer to bugs after it - I'm pretty sure there's a scene where he bottles up a bug and releases it back into the wild