The manual page for ebuild lists the functions in wrong order. It should list them in the same order portage executes them. In particular, man page has preinst before install. According to https://devmanual.gentoo.org/ebuild-writing/functions/index.html, install runs before preinst. The man page does not explicitly say that functions are listed in order, but it claims that 'portage will execute all the functions in order up to the one actually specified', without saying what 'the order' actually is. Therefore a reader may assume that they are listed in order.