Strip a hormone down to its essence and it is simply a molecule that one cell releases to change the behaviour of another. By that definition the practice is nearly as old as life itself. What we call the endocrine system — dedicated glands squirting messengers into a bloodstream — is just the most elaborate, latest version of something cells were doing when the whole planet was microbial.
This is the single most important idea in the story, so it is worth stating plainly: the molecules came first, and the organs to make them came later. Across the entire tree of life the same chemical vocabulary keeps reappearing — signalling molecules in microbes, plants, fungi and animals that are structurally related, and sometimes literally identical. Melatonin, for instance, runs unbroken from cyanobacteria all the way to you.
Evolution, it turns out, almost never invents a messenger from scratch. It finds a molecule already lying around — often one doing some humble metabolic chore — and hands it a message to carry. Keep that principle in mind for everything that follows: borrow, don't build. It is the thread running through every hormone we know.