So how do they balance nine hundred Pokemon, and keep most of them relevant?
Balance in the sense of making all Pokemon viable? You don't. It's basically impossible. Honestly...that's a good thing. A Pidgey should not be viable against a Mewtwo.
Previous Pokemon games have had weather, seasons, and day/night cycles affecting Pokemon spawns, so there's many ways to have a variety of Pokemon spawn in various ways in the game.
Plus, a good chunk of those Pokemon would need to be traded. If you wanted, you could have traded a Pokemon from the Gameboy Advance era (released in 2002) and brought it to the Sun and Moon games (released in 2016). Sword and Shield removes the data of a huge number of Pokemon, who might not have been balanced, but might have been people's favorites