I understand why anime takes place in high school a lot, because its intended audience is high schoolers.
That doesn't match my understanding of why so much anime is depicted in high school. While, yes there is a lot of anime targeted at high schoolers, as it was explained to me is that high school is the last time in Japanese culture where your future is undefined on a path. As soon as you leave high school you're into one specific education, vocation, or career path where deviation after choosing your path is rare or not social acceptable. High school period is the last place in Japanese culture where everyone is mostly equal and unbound by expections. Many of the stories follow the nature of change or growth. So this requires the point in character's lives where you can tell it.
Other story tropes used to transport older characters back to this time include:
- body swap to a younger body or de-aging where social rules allow a person to change again
- isekai, where the character is transported to another world (where the same rules of defined path don't apply)
- reincarnation, where the adult protagonist is reborn into the body of a child or teenager, again to place them in a point in society where change or freedom of choice of path is allowed
Some of the above is just my speculation. Other portions is what I've learned from others. If this is wrong and other people here know definitively, please correct me. I don't want to be spreading wrong information.