Historically, Nepalese expansions were more successful towards Tibet than India (as a nepalese, we feared the malaria forests of south so we rarely ventured south). Also, most Nepalese had more ties to Tibet than India before the arrival of India friendly rulers. Even during the Newar periods of rule, the Licchavi were allied with the Tibetan Empire and historical documents suggest they were under them for a good 200 or more years. The Malla, while being Hindu rulers themselves, ruled over a majority buddhist kingdom in reality.
Anyways, in historical context, the reason the Gorkha lost with the british was due to having fought 3 simultaneous wars before hand (we invaded tibet and took Shigatse, were in a war with Sikkim, and were fighting the sikhs in gharwal). Our treasury was nearly bled dry and the people weary of wars. Not to mention that our leaders made the wrong decision to withdraw back to the border after having taken much of southern tibet, up to Shigatse (which led to war with the Qing army later on in the 3rd campaign after winter).
The Sino-Nepalese war with Qing was nearly disastrous due to the previous retreat of our forces from Shigatse(Xigaze; called Digarcha in Nepal) to our current border. Thus, when the Qing arrived and saw southern Tibet undefended and in near ruin, it became easier for them to take direct control of Tibet, as well as easier for them to attack us and they drove our forces as far as within 30km of Kathmandu(we did try to buy howlitzers from the British but they demanded trade concessions or they won’t deliver so that was a failure). Since both sides suffered heavy casualties, the Qing and Nepal agreed on a treaty to end the war and Nepal then turned to sikkim and the sikhs.