As mentioned there's a lot of zigzagging about.
I'd agree that it makes more sense to head to St Andrews first. You take the tram (or a cab) to Edinbirgh Gateway stn and then there is an hourly train to Leuchars. You get off there and catch a bus or taxi to St Andrews.
Your brother will surely be jetlagged on July 22 and you wouldn't get to St Andrews till about 1pm, so you might not see that much that day. It depends what you want to see in St Andrews - If it's just the town itself a full day is plenty, but if you want to see something else in the area (i.e. the E Neuk fishing villages) then you'll need half a day or so longer, particularity if using public transport. Personally I think St Andrews is much nicer than Stirling, but I'm biased;)
If you're still set on going to Glasgow first - I presume you're arriving at EDI airport - then the airlink bus is the way to travel as it departs from the airport forecourt. The train does not serve the airport. That said, Glasgow has a perfectly good airport, so if you're heading there first then I'd fly there instead of EDI. There are are 6 or 7 flights per day to Glasgow from Dublin.
You can travel from St Andrews to Glasgow - 99 bus to Dundee rail stn (30mins) and then train from Dundee to Glasgow Queen Street (90mins). There is a direct bus from St Andrews to Glasgow (X24), but its slow and takes longer than the the bus/train combo via Dundee. Alternatively, you could head back to Edinburgh and spend time in Edinburgh and then go to Glasgow nearer the end of your trip.
It is certainly possible to visit Glasgow as a day trip from Edinburgh, the train service is very comprehensive, with a journey time of about 50mins and trains run late into the evening. However, bear in mind that Glasgow is more than twice the size of Edinburgh and many of the best known attractions are not in the city centre and spread out across other neighbourhoods - for instance the Kelvingrove and Riverside Museums are in the West End (although different parts!) and the Burrell Collection is in the Southside. So you need to build in time to get between these attractions by public transport as well as actually see them. As such, if you just want to see one or two very specific things a day trip is probably OK, but if you want to see or do more in terms of museums, food, drink etc, then you'll definitely need a good bit more time than a day trip provides.
Stirling can be visited as a day trip (or even 1/2 day) from either Edinburgh or Glasgow, its about half an hour by train from either.
It's noticeable your visit is focused on the "central belt" and doesn't include any time in the Highlands or islands. If you want to concentrate on cities/towns then go for it, but the Highlands are many people's highlight of Scotland. Edinburgh is not particularly close to the Highlands, although the geography of Scotland (Highlands extend much further south in the West) means Glasgow is somewhat closer to Highland scenery and has more public transport links to the W Highlands. There are companies like Rabbies and Discover Scotland who offer day (or multi day) tours from both cities. Simple day train trips into the Highlands would be Loch Lomond or the scenic W Highland line from Glasgow (although it's a long way to do up and back in one day!) or Pitlochry and Dunkeld from either city (although you're maybe a bit limited with no car once there). I guess you could do something like this with your spare days?
If you're going with St Andrews, Stirling, Edinburgh, Glasgow then you don't need a car (indeed you probably don't want one in the latter two!). If you want to get our into more rural areas then it's generally better to have one.
There is the currently industrial a ruin disrupting train schedules here. The seems to be hope it might be sorted soon, but who knows! There are plenty buses though - and they're often cheaper than trains - but slower!