If you want at least double travel time and probably also pay at least same as for a direct bus, then just do it. Best site-as it loves trains so much and plans trips that use trains the most: seat61.com. This lists all overland trips from UK to all EUR countries-so just join it from PL or LT.
The general prob here is that the main=near only raillines in both LT and LV run east-west (the old main lines to Mockba, the then capital of the real existing socialist world-ask your granpa) and this connection is mostly North-South.
However-if you also would want to see more of those countries as just the capitals: check if there is also a bus along coast from Klaipeda (=end in LT seaside of main line) to Riga or maybe Kauno or Vilnius to Daugavpils (mostly still russky-aimed) in LV by bus.
There may also be more info (google will find it) as dedicated railfans and those who believe they should/have to use those railpasses ask at general main touristy forums-best known is tripadvisor->forums->EUr->country. There may also be a dedicated CZ zeleznice forum-this country has lots of often very knowledgeable elder/pensioned zeleznicare robotniki/pracovniki
I´ve done my very 1st trip via these 3 then newly formed countries just after independence-when one had to buy a visum for 50DEM-then there still were those Russky style (platskart/Kupeyny) very old/cold and hardly used anymore overnite trains Vilno-Riga and Riga-Tallinn-the only other pax were also foreign visitors then-that was some 30 yrs ago by now. I also travelled extensibly in what was still Czecho-Slovakia on CSD for a very few koruny. All history now from long ago.
It's possible to travel directly by train between those cities, but you have to send an email 3 working days before travelling to make a seat reservation which costs 5€. All this info is available on the LTG website. It's also possible doing the trip by bus and there's discount for Eurail travellers in Lux Express, search on Eurail website.