The writers were just starting out, and they needed to figure out a way to feature every single one of the original 151 pokemon before their 80-episode-1-movie deal was up. They knew that Ash would use the four biggest cash-cows (Pikachu, Bulbasaur, Squirtle and the Charmander line) as his main team, and that left a hell of a lot of pokemon to find a feature episode for. They apparently thought that introducing a species as a temporary team-mate was completely legit and could provide some nice moments, but those characters would only serve their purpose for a short time and simply be part of the journey. That was the logic they went into the show with. Each of the temporary captures had their purpose;
-Caterpie, who was noticeably alone rather than a member of a swarm, wanted to fly, and Ash raised it to be a Butterfree and achieve that dream. It then brought things full circle by wanting to fly away and have its own Caterpie babies and raise a family. Butterfree was never meant to be a battling pokemon, it was meant to showcase the Caterpie evolution line and be developed as a character on their own little journey.
-Haunter was just part of the showcase for Ghost-types (which tied into the debut of Abra/Kadabra) and to be comic relief. Gastly had a major episode, and Gengar would have a large (literally) role in a later one, so this was Haunter's extra bit of a featured role. That's all it was ever going to be.
-And then we come to Primeape, who primarily showcased the Mankey/Primeape family in its debut episode, then was used for a significant challenge and a little character development for Ash, and its departure episode was a chance to showcase all those other fighting-types which they needed to get through. Primeape did everything it was ever intended to do. It backfired because the writers did it TOO WELL- everyone just wanted more Primeape and its departure wasn't conclusive enough for people to accept that its time was just done. It was actually good writing by this show's standards, but Primeape won so many fans that over a decade on people just can't accept that we had to say goodbye.