I have taken the train, admittedly in stages, both to Lisbon, and to Madrid… And as much as the bus will do in a pinch, I do prefer the trains (for their washrooms, for their food service, for the ability to get up and walk about, for the generally better views… And yes, you have to go to Vigo, switch, then on to Porto and switch. I had a stop over for a few days in Salir do Porto before continuing on to LIsbon, but I just picked up from there and continued to Lisbon. No problem.
If you are having difficulty, the people inside the entry to the monasterio museum — which is where the train ticketing information was when i was last there in 2019 — will be happy to help you.