It is probably a mistake to inquire too deeply into the meaning of Robert Louis Stevenson's Treasure Island. He wrote it mainly for the purpose of entertaining boys with a story involving treasure maps, pirates, travel, danger, adventure, and a rich reward. According to the Introduction in the eNotes Study Guide (see reference link below):
Treasure Island is considered one of the first adventure stories written specifically for adolescents without an obvious emphasis on teaching morals. This is not to say that Robert Louis Stevenson's novel about a young boy is without lessons but rather that its emphasis is a coming-of-age story filled with challenges, fears, and triumphs like any exciting and fun-filled journey of exploration. The lessons are learned through the characters' decisions and mistakes, which makes them more lifelike and less didactic.
Jim Hawkins is a young lad who sets off the whole adventure by finding the treasure map and interesting the grown men in outfitting a ship and going off in search of the island. It is significant that Jim is the hero and the viewpoint character. This is a story designed to involve and entertain boys about his own age.
The main moral of Stevenson's story is that the good and honest people win the prize, while the wicked and treacherous people are punished for their evil deeds. The good guys always win and the bad guys always lose.
Jim Hawkins has a lot of growing up to do in a short time. The dangers bring out the best in his character. He finds that he has resources of nerve, physical strength, and intelligence he hadn't formerly known he possessed. The book has been read with pleasure for over 130 years, and no doubt Jim has been an inspiration to many young male readers.
According to the Summary in the eNotes Study Guide (see reference link below):
The book was published in serial form in a boys' magazine, Young Folks, and it follows the format of the standard boys' adventure novel. A boy is drawn into a fantastic, dangerous adventure, but through courage, integrity, and the help of a heroic mentor, he comes through the adventure unscathed, wiser, and more mature.
Treasure Island differs from "the standard boy's adventure novel" in having been written by an exceptionally gifted fiction writer, Robert Louis Stevenson, who also wrote The Strange Case of Dr. Jekyll and Mr. Hyde and many other interesting works including short stories, essays, travel books, and volumes of poetry. At one time Stevenson was internationally famous, but he is now best remembered for Treasure Island, Kidnapped, and The Strange Case of Dr. Jekyll and Mr. Hyde. His essays are examples of the highest quality English prose.