Sofia can be reached (just) from Romania and Turkey. So it’s possible to go from Budapest to Sofia (in fact daily at 15.10 if you’d like to go without additional stops in between; no direct train), but not from Sofia to Beograd (you may go by bus to Niš in Serbia (about 4h / 15 €) and from there by train to Beograd.
There is no international train service to Skopje. If you’d like to go there, you need to go by bus.
Mojkovac can be reached from Beograd (a daily direct night train and in summer a day train with change of trains at the border).
Beograd can be reached (just) from Hungary (e.g. Budapest; full day trip with many changes) and Montenegro (e.g. Mojkovac; see above).
The rest has frequent services. Going from Budapest to Praha and / or Bratislava is no problem at all.
E.g. it’s possible to go from the Netherlands to Prague by night train, then to Bratislava, from there to Budapest, from there to Beograd, from there to Mojkovac, from there back to Beograd / Niš / by bus to Sofia (or going by bus to Skopje and back), from Sofia back to the Netherlands (via Budapest; from there are many options, e.g. by direct night train from Wien to Amsterdam). Or the other way round.