As a Brazilian who grew up in the 90's, I grew up watching tokusatsus and Shounen animes. The media wasn't wrong in accusing the animations of being brutally violent (the live actions, not so much), and therefore sensationalist, but this wasn't why my generation loved them. They had this emotional depth, this gritty feeling, this catharsis that I later discovered adults called tragic.
Protagonists with tragic flaws; moral choices and opposition of parties with different virtues; fatalism. I remember seeing it in Zodiac Knights and Kamen Rider; and more recently in Attack on Titan and Neon Genesis Evangelion. This set them apart from the American products. Kids in Brazil learn to despise American mass culture early, but the attitude towards Japanese pop culture is much more respectful because it doesn't seemed as brainless or commercial to us.
How did Shounen media developped characteristics so close to the western idea of tragedy or maturity? Or why didn't Western juvenile media? Is that related to the perceived violence of Shounen?
First, I think the idea that the values you mentioned are an inherent trait Shounen anime/manga isn't really accurate. The term itself simply refers to the target demographic: teenagers. So that's a part of the difference in themes; American cartoons tended to be aimed at a pre-teen audience (though this is somewhat less accurate now...) As for series: NGE, in part, was a critical take on the ideas of classic mecha series like Mazinger Z and Tetsujin 28-go as well as being heavily influenced by director Anno Hideaki's personal struggles at the time of its creation. In the case of AoT, it owes a lot of its success to how it treats the "standard" shounen ideas of friendship, personal growth, and determination. But most mainstream shounen, generally, aren't like these series: One Piece, Naruto, DBZ, Blue Exorcist, Hunter x Hunter, etc. don't really have the same level of depth that you seem to be asking about. (though I'm sure this is considered debatable in some circles.) Ideas of depth in certain shounen genres can be traced back to specific shows: the ideas in the Gundam series, for example, contrast with the more simplified morality of the aforementioned Super Robot series. Also, anime in the 70's wasn't a thriving genre; television was drawing off talent and so younger artists had more freedom because the industry became so sparsely populated so they could create shows with the characteristics you mentioned without being hampered by a focus on sales. On the other hand, DBZ was also a massively influential show and its influence is still obvious to this day; many mainstream shounen tropes owe their existence to what DBZ pioneered. However, DBZ didn't focus on moral grey areas and such; it was always a fairly simple show from a characterization standpoint (compared to others) so the shows that draw from its ideas display similar characteristics. People copy what works. To sum up, thematic depth or lack thereof in anime stems from certain pioneering series, but ultimately it's harder to categorize shounen because it isn't really a genre; rather, it's a publication/demographic identifier.