Ascertaining an author’s exact intent in writing a book, poem, or play is tricky business. Let’s look at your question from both a pragmatic and figurative perspectives.
The pragmatic response to your question would be that William Shakespeare wrote his tragedy Romeo and Juliet to earn money. By the time he wrote Romeo and Juliet sometime between 1591 and 1596, Shakespeare was a successful actor in his company, Lord Chamberlain’s Men, and a promising playwright. However, the nature of Elizabethan theater meant that new plays needed to be created regularly to continue to bring in an audience. Without new plays, an acting company would quickly go bankrupt. The fact that Shakespeare authored at least 37 plays through a relatively short career (spanning less than two decades) is a testament to the need for regular additions to a theater's repertoire. Shakespeare did not pen his stories for literary fame or glory. He was a businessman who happened to earn his money in the theater business, and he was good at it!
However, although Shakespeare did write his plays for pay, he was clearly interested in exploring themes of love, lust, and resistance to societal expectations in Romeo and Juliet. The most obvious thematic exploration is the nature of love. Romeo and Juliet both believe they are deeply in love with one another. However, in the very first scene, Shakespeare acknowledges through his character Romeo that love is messy and difficult to define:
Why then, O brawling love, O loving hate,
O anything of nothing first created!
O heavy lightness, serious vanity,
Misshapen chaos of well-seeming forms!
Feather of lead, bright smoke, cold fire, sick health,
Still-waking sleep, that is not what it is!
The question Romeo poses in this passage is: What is love (baby, don’t hurt me)? With an emotion so difficult to describe with language, is it any wonder that love gets so many people into sticky situations? Differentiating between authentic love and temporary lust or infatuation is difficult and has been for all human existence. Shakespeare explores this theme by writing the story of the “star cross’d lovers,” leaving his audience to wonder whether Romeo and Juliet showcase true love or naivety; with love, it’s not always so easy to determine!
A second theme Shakespeare explores is the consequences of fighting societal expectations. Romeo and Juliet go against their family’s wishes with their clandestine romance, and their decision has far-reaching ramifications. Romeo and Juliet’s struggle against oppressive expectations for their behavior resonates with modern audiences because it is universal. All humans have faced it, in some form or another. We can never know for sure, but dissecting these themes are likely part of why Shakespeare wrote Romeo and Juliet. I hope this helps!