Nepal too, was never ruled by the British. However, Nepal's rulers were pro-British, and received a lot of assistance from them (Though they did have some wars initially).
As a result, there used to be 2 major lines connecting Nepal and India. An NG line from Jaynagar (in India) and an MG line from Raxaul. The MG from Raxaul fell into disuse in the 70's. The NG line from Jaynagar used to operate until recently and is now being replaced with a BG line.
As Nepal...
more... was a completely land-locked country without little scope for industrial traffic, these NG and MG lines were sufficient for the traffic in those days. So, no major railway connections were ever developed. But with Nepal becoming strategically important due to China's growing influence, a proer BG connection is now in progress.