I did the same thing but used Java as the initial code generation target back around 2010 (for a personal project). Since the network protocol wasn't controlled by me, this approach made keeping up with changes trivial.
IIRC, a lot of that was enabled (at least in the US) by the wider-scale rollout of 3g and smartphones. Before that, not only did few people have smartphones (uber initially had both a website and phone number you could contact to get a ride for at least a few years), but even metropolitan service areas were too spotty for near-realtime apps to work effectively.
I believe that while there are various guidelines and studies, it is typically up to the transit agency itself to determine stop density and locations.
There are many companies that provide transit planning solutions which use GIS (with census data) to aid the process.