There are three largely inexperienced youths in Treasure Island. Abraham Gray is fresh off the farm and decides to stand by his captain rather than his new sailing buddies. His reward for loyalty is a portion of the treasure, which he uses to buy a share of a ship and start a family. Then there is Dick Johnson, who is weak-willed and easily flattered. He decides to go with the flow and join Long John Silver and the pirates. His reward for this treachery is to be marooned on Treasure Island as he becomes steadily sicker with fever. Last but not least, there is Jim Hawkins. He is neither obedient like Abraham Gray, nor is he easily bullied like Dick Johnson. Jim is a free thinker who is willing to strike out on his own. This independent thinking is what enables him to save his friends. So is Stevenson encouraging young people to ignore their elders and follow their own instincts? We will leave that question for you to ponder.
As the youngest man in the novel, Jim has the fewest duties, and this freedom allows him to explore the island without terrible consequences.
By blaming his own morally questionable decision to leave the fort on his youth, Jim is showing his bias as a narrator. Doctor Livesey is an adult, takes risks much like Jim's, and receives no such excuse from Jim's narration.