When the first Pokémon Red and Blue games were released, players had to accomplish two main goals to win. Catching, training, and using Pokémon in battle was the first goal on the way to becoming a Champion. The second goal was to finish the Pokédex by capturing every Pokémon that was out there. In the anime, Ash fully accomplished the first goal but largely neglected the second one.
Until Goh was introduced, neither Ash nor his traveling companions were particularly interested in capturing Pokémon for whatever reason. Yet his debut occurred close to the conclusion of Ash's adventures, 20 years into the anime's run. This might be related to how catching Pokémon is portrayed in the anime and how attitudes toward the idea have evolved over time.
How Was Pokémon Catching Seen Before?
In the first episode, Ash pledged to catch all the Pokémon in the world. By the games' standards, this would have meant catching all 151 available Pokémon and creating a living Pokédex. It is a reasonable goal to have; however, this was likely meant to be seen as a young boy making a bigger promise than he could keep, as it's rarely brought up again. He instead focused on catching the few Pokémon he'd need for his Indigo League challenge.
Ash's travel companions would similarly only catch a handful of Pokémon, usually even fewer than Ash. They also dismissed the idea of catching all Pokémon in favor of some other goal, such as becoming a Breeder, Coordinator or other type expert. None of their goals necessitated the capture of every single Pokémon.
Besides this, the need to fill the Pokédex wasn't as pressing in the anime as it was in the games. For all intents and purposes, the anime Pokédex was already full, given that it would automatically provide information on any Pokémon presented to it (in the games, players must catch a given Pokémon in order to obtain the same information). If anything, it works as an expository shortcut so that the main characters don't have to catch every single new Pokémon in order for the viewers to learn more about it.
Furthermore, catching only a few Pokémon might have been a matter of fostering an emotional connection. If the Trainers were constantly rotating out the Pokémon in their main roster, they -- and the audience -- would have had more difficulty learning to care about any of them. Keeping party sizes limited in this manner allows everyone to develop a familiarity with certain Pokémon and become more invested in them. If someone like Goh had been introduced to the anime when such sentimentality was the norm, he might have seemed out of place.
What Had to Change for Goh to Be Introduced?
What likely changed all this was the advent of Pokémon GO. Unlike other installments in the franchise, this game was exclusively focused on catching Pokémon and building a living Pokédex. It even encouraged the capture of additional Pokémon of the same species. All of this discouraged the idea of developing connections in favor of catching as many Pokémon as possible. This focus on capturing led to similar titles like Pokémon: Let's Go, Pikachu! and Let's Go, Eevee! and Pokémon Legends: Arceus.
Thanks to the popularization of capturing Pokémon as an objective, introducing a character like Goh was finally possible for the anime. He could catch as many Pokémon as he wanted and wouldn't be faulted for any underdeveloped connections. If he did grow close with Pokémon -- as indeed he does with Cinderace and Grookey -- it would simply be a bonus, tangential to his main goal. If a game like Pokémon GO had come out sooner, then the anime might have introduced a similar character sooner, as well.