The Soviet authorities rebuilt the track to the Russian gauge after the Soviet forces drove the Wehrmacht back; whether this was as their troops advanced or after the war had ended, again I don't know.
According to
this page (which I found by Googling for confirmation of a memory of having read that Stalin travelled to the Potsdam conference in 1945 in his own train), a single track of the Russian gauge reached as far as Berlin in the very last days of the war, but the part outside the USSR was converted back to standard a few months later.
A lot of the railways in the Russian borderlands have changed (both ways, sometimes for military reasons).
As with the east Baltic countries mentioned above, there were changes further south with Russia's boundaries ebbing and flowing. For example, an American visitor wrote about what is now Moldova:
... and after WW2 they changed it back again.
Given the unfortunate 20th-century history of that part of the world, I suspect that some lines in eastern Europe had their gauge changed several times between 1914 and the late 1940s.
Sarajevo-Ploče (Bosnia-Croatia) was originally served by Bosnia's extensive narrow gauge network, though how much of the original trackbed was used for the modern railway is another question (I remember a tunnel wide enough for double track between Sarajevo and Mostar).
I think the current summit tunnel was built in the 1930s to reduce the amount of rack working on the narrow gauge line, but built to a size suitable for future use by standard gauge trains. I think quite a lot of the current route must have been built new, as the rack sections weren't reused and significant parts of the old line are submerged beneath reservoirs, but on one such stretch the reservoir predated the gauge conversion and narrow gauge trains ran along the new formation for a few years. South of Mostar, I remember a few places where the narrow gauge formation could be seen leaving and rejoining the current alignment, for example to go round a bluff that the line now tunnels through.
In the post-WW2 era some of the Polish narrow gauge lines had their gauge changed, in what I think may have been an attempt at standardization. For example the system of which the Środa-Zaniemyśl line* formed part was converted from metre gauge to 750 mm in the early 1950s.
*(which some people may have heard of because it remained steam-worked until the beginning of the 21st century).
and likewise-s/g Poland (though this latter was pretty much brought to nothing, by Lithuania and Poland falling out over ownership of the city of Vilnius, and spending all the 1920s and '30s in a total "cold war" situation -- mutual hostility to the max.
Apparently the border did reopen in 1938, although this didn't result from an outbreak of friendliness -- see
https://en.wikipedia.org/wiki/1938_Polish_ultimatum_to_Lithuania#Aftermath -- and obviously neither side had long to enjoy the ability to travel.