I don't follow gymnastics, but she is certainly talented, and seems a decent enough person. I think her decision to remove herself was probably wise. Her routine includes moves that others can't do and are considered at the edge of what is safe to perform. If she lacks complete confidence so that anxiety is not merely a bad feeling but an active interference in completion of vaults, she may be endangering herself. Some events are like that, such as various skiing events or the pole vault. You could damage your head badly. I have nothing against her for assessing the situation and believing her danger was too great, even for a gold medal.
The response to her decision interests me. She is being called brave for doing this. It is socially brave, as she will endure criticism and contempt for it. We are social creatures, and that does mean something. Yet unless complete ostracism or banishment were on the line, most of us would find such criticism endurable. There would be a cost, but I have been criticised before. It is likely significant that as an athlete, her job is to be an entertainer, though we don't often characterise it that way. Therefore, she would be more sensitive to social losses and take them harder. She lives in the fishbowl. That has been true for athletes for years.
Though that cost has been increasing over the years, I think it has skyrocketed recently, and the young in particular might rate social courage higher than those who are older, who might rate physical, financial, or even spiritual danger much higher. I'm not saying she's not brave. It's just that I frame this more as a wisdom decision. The social cost is there, but I think my generation would not be so alarmed by it.