On the possible origin of the trope:
From Piperson at The Great Comic Book Heroes
Men in Tights - a history
When Superman first hit the scene with his blue and red tights it
created a shockwave around the country that it hit off the whole
superhero craze that is going on stronger than ever today with
blockbuster movies like Batman and the Avengers. Before that no one
had ever seen a hero in tights and cape. Where did they get the idea
Siegel and Shuster created a character called Superman in 1933 though
it bore very little resemblance to the Superman we know. He had mental
powers but had normal strength. A year later they would re-envision
him into a super crime fighter.
From Wikipedia on the creation of Superman - “The pair re-envisioned
the character, who became more of a hero in the mythic tradition,
inspired by such characters as Samson and Hercules, who would right
the wrongs of Siegel and Shuster's times, fighting for social justice
and against tyranny. It was at this stage the costume was introduced,
Siegel later recalling that they created a "kind of costume and let's
give him a big S on his chest, and a cape, make him as colorful as we
can and as distinctive as we can."
"The design was based in part on the costumes worn by characters in
outer space settings published in pulp magazines, as well as comic
strips such as Flash Gordon, [Doctor Occult, the Phantom,] and also
partly suggested by the traditional circus strong-man outfit, which
comprised a pair of shorts worn over a contrasting bodysuit."
Around this same time Alex Raymond's Flash Gordon hit the funny
papers. He would often wear tights and cape so it's not very far
fetched to imagine that this very popular strip was a big inspiration
for the creation of Superman.