Ergot is toxic and eating contaminated bread has been a historical problem, but the results of ergot poisoning, contrary to pop science/history accounts, don’t seem to be much like the results of LSD, although there is a neurological component. It is plausible that the evolutionary “purpose” of the alkaloids is to poison animals that eat it, but whether the benefit to the fungus comes from decreased predation, improved dispersal, or something else is unclear.
Certainly there exist fungi which produce psychoactive compounds in order to alter the behavior of an animal, such as the charming Massospora cicadina, aka the cicada sex zombie fungus.
Minor quibble: Hamilton the musical is based on the biography of Alexander Hamilton by Ron Chernow. So while Lin-Manuel Miranda did arguably know a lot about Alexander Hamilton once he had read the book, I would say that his unique contribution was not (musical theater composition) + (Alexander Hamilton facts), but specifically the idea that a biography of a historical figure most well-known for being killed in a duel with a former vice president was, in fact, material that could be adapted into a musical. (And furthermore that it should be a rap musical.)
Anecdotally, I know a guy who wrote an opera using the transcript of a routine small-town city council meeting as the text, but it didn’t become a hit.