When fans were either reading or watching Dragon Ball Z for the first time, they likely thought that Goten and Trunks' unique "Strongest Under the Heavens" Tournament match during the Majin Buu Saga was completely unnecessary. In fact, anime viewers were likely under the false impression that it was filler and would be surprised to know that it did appear in the manga. Although goofy, it was a rather ingenious foreshadowing of Goten and Trunks' fusion as Gotenks.
Even though a wildly popular character, especially when he transforms into Super Saiyan 3, Gotenks' role in Dragon Ball Z is almost exclusively relegated to comedic relief. Most of his attacks are incredibly ridiculous, especially his signature Super Ghost Kamikaze Attack, a move that involves eponymous spirits getting expelled from Gotenks' mouth. Additionally, the prodigy duo almost always find themselves in outrageous scenarios that are usually the product of their misplaced self-confidence. And this isn't even taking into the absurd number of times in which Goten and Trunks' fusion fails, a flat-out joke that is inherently overutilized.
Goten and Trunks’ Forgotten Battle as Mighty Mask Foreshadows Gotenks Perfectly
Mighty Mask's Big Moment Was During His Fight Against Android 18
The fact that Gotenks usually finds himself in ludicrous situations isn't wholly why the kids' fight during the Strongest Under the Heavens Tournament foreshadows their fusion, though it is a contributing factor. It's how Trunks and Goten disguise themselves as a fighter named Mighty Mask so they can sneak into the adult division. With Mighty Mask's clothes over them, Trunks sits on Goten's shoulders so that he serves as the upper half of Mighty Mask, while Goten controls the lower extremities.

Goku vs Guns: Dragon Ball Daima Finally Settles a Popular (and Surprising) Debate
Dragon Ball Daima episode #15 just broke with a tradition that has been prominent in Dragon Ball by having guns play a major role.
In essence, Goten and Trunks are imitating a fused state as Mighty Mask whereby they pretend to be one whole person, who has a completely different identity from their original selves. While they have difficulties fighting, this way is another perfect characteristic to foreshadow their future battles as Gotenks, where they are quite literally fused instead of pretending to be.
Luckily, Mighty Mask's match could have felt even more like filler if they had only fought lame contenders. Instead, the duo battled Android 18 during a battle royale round, which was an effective way to gauge just how incredibly strong the two Saiyans were at the time. This was necessary since they were so young and could achieve Super Saiyan mode, which was controversial at the time since Akira Toriyama hadn't yet introduced the concept of S-Cells. It was also a defining moment for 18 since she wasn't fighting as an android.
Dragon Ball Z’s Genius Storytelling Is Hidden Behind Epic Fights
The Effectiveness of Mighty Mask's Setup Is Shrouded In The Same Way As Most Fights in the Original Dragon Ball Series
Unfortunately, most people are under the false impression that Dragon Ball Z is just an over-the-top martial arts series that favors mind-numbing fights over actual literary devices, when, in actuality, Dragon Ball employs great storytelling. The flashiness and frequency of these battles undoubtedly contribute to this misinterpretation, but in the case of Mighty Mask, it's even worse because it's hidden by its signature adolescent humor.

It's True: One of Dragon Ball Z's Biggest Mysteries Just Got Answered With a Surprising Retcon
Dragon Ball DAIMA fixed one of Z's biggest mysteries by revealing the real reason why Dabura was such a weak opponent.
Ironically, the latter example is what causes people to undervalue the original series. Most of the fights were ridiculous, but Dragon Ball masterfully utilized strategy to explore recontextualizing and weaponizing anatomical weaknesses, exploit a key trait of a fighter's personality, and incorporate the use of items rather than relying on strength. Goten and Trunks' fight as Mighty Mask in Dragon Ball Z continues in the tradition of the original series by leveraging the coveted literary device of foreshadowing to set up the debut of Gotenks.