The thing about anime characters is more to do with licensing than a lot of other things. But yeah, Lucario did debut in an anime... but mostly for advertising for the games.
There's a few better examples of characters who were never meant to be anything but a video game character(Starkiller was created to be a specific video game only subsection of the Star Wars franchise. He's an actual true video game character as all of it has no connection to the movies beyond the core mechanics of things like how the Force works, obvious stuff like Lightsabers, types of robots, etc. But still no connections. It was pretty much its own thing at that point. We don't allow a thread on the character for two reasons; it's still borderline from a non-game franchise anyway and it's pretty hard to justify that but characters who are in similar situations, like Xenoverse!Goku or Android 21. Slippery slope is something we wanted to avoid. The second thing is Disney decided to combine the game franchise with the main one, eliminating it being an actual game-specific thing, so it no longer was a game character officially anymore).
In fact, R.O.B. wasn't made simply for a video game franchise, so much as a way to play the game. But the fact he's owned by Nintendo made it an easy add-on cause they don't have to license tons of people. He also had an important part of game history, which is that he helped the NES sell after a pretty large video game crash. So despite not being a literal game character, he was still important to video games.
For a reverse Lucario situation, to some degree, the demo for the video game version of Wreck-It Ralph released before the movie. He technically did debut in a game. Demos are still an actual release of sorts. But in reality, it didn't matter anyway even if the full one released first. Why? Because it was made to help a movie, not to be a video game franchise. That's why Lucario is still a game character anyway, cause he's just in an anime to advertise the games specifically. In fact, he's not the only Generation 4 Pokemon who debuted in the anime(Mucnhlax too). It's pretty much what franchise type they are first that is how they're a game character. However, Nintendo characters can potentially not be a game character first and still get in, but only cause they're owned by Nintendo. It would be obvious that at the very least they would have to make a video game appearance too. Otherwise, even with semantics, they can't be a game character if they were never in a game. You know?