The studies I have seen compare the the risk of contracting myocarditis between those who were vaccinated who get COVID 19 and those who are not vaccinated who get COVID 19.
This is a distinction, because if one never gets COVID 19 at all, then it would be true that getting the vaccine represents a higher risk of myocarditis than not getting it. BUT it is highly unlikely in the long run that many, if any will avoid the virus, and the overall rates of myocarditis from COVID (as with other viral infections) is much higher than the rate from getting it from the vaccine.
Thus, while Jim mis stated the point somewhat, it is my belief that hhe is still correct in his overall point that staying unvaccinated actually leaves you with a higher chance of getting myocarditis in our world with he coronavirus circulating through the population.
There are other risk factors and health considerations besides myocarditis, but it definitely the wise course for the vast majority of the population to get vaccinated. This could be different if you have a past history of myocarditis or other health risk factors such as Guillan-Barre, and thus it is wise to discuss these issues with your doctor who knows your specifics.
Here is a recent study on the younger age groups.
Link: https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8328065/#__sec5title