Brian, this is a classic itinerary I think - I visited these three cities together - train between them - the first time I visited any of them. (I loved Prague more than the others and visited Prague again a few years later.) Yes, taking a train between them makes logical sense. I don't think it matters whether you fly into Prague out of Budapest (as I did) or vice versa. Maybe it depends whether flights work out better for you one direction or the others.
I would probably plan it both directions (regarding plane tickets, train connections, etc.) to see if one way makes more sense than the other. When I did my trip almost twenty years ago, I really didn't plan it - it was very "ad hoc." My only constraint was that I was meeting a friend in Budapest, so that's how I set the timing of flying out of there vs. starting there.