With the Eurostar, they do passport control before you board, as I understand the process. I did something similar decades ago - went through US customs in Toronto before flying to the US on a transfer there from Europe.
Correct. Essentially, they do the equivalent of a US Customs & Border Protection (CBP) check before you get on the train at St. Pancras Station in London and Gare-du-Nord Station in Paris. In Hong Kong, Chinese customs authorities do their check at the station before you enter the train platform for their CRH service into China, since the train platforms are still considered Chinese territory even though the station is on the Kowloon side of Hong Kong.