It’s 18 years because we have 9 justices, and if we want to make terms expire on a regular basis we need to tie it to the size of the Court.
But guess what? If you pack the court to 13, then the math makes the term 26 years. Much more reasonable, right? I prefer a shorter term , so after the court is packed I would advocate for 13 year terms, renewable once. But I would accept 26 year terms, too.