I've been thinking about your long train day. So I looked in the timetable. I knew it was possible, but I thought that you might want to think about choices on the way back to Luzern.
(By the way, i picked a Monday for my test of the itinerary. If you go on Sunday, double check the Centovalli time schedule. Service times might be different. The rest are likely to be the same and frequent enough to work OK. You don't want to get stuck in Locarno with a planned 2 hour break becoming a 4 hour break. ;-)
I picked what I thought were reasonable times, but you can work the timetable to refine them.
Depart Luzern at 0818. No changes to Locarno. Arrive at 1113. If you want to make changes, get off the train at Arth-Goldau, catch the Express to Bellinzona at 0850, change at Bellinzona, and arrive at 1056. The changes are easy, and I'd pick the faster route, but, you can choose. You will likely need those few extra minutes.
At Locarno, visit the Madonna del Sasso at the top of the special funicular, get a quick bite on the lake shore and walk the promenade a bit, and catch the train to Domodosola at 1249. Note the gap in the schedule at lunch hour. If you miss the 1249, then you wait until 1449. No 1349. You do want your train driver to be well fed and rested, right?
Note that the train to Domodossola leaves from a different station, a short walk from the "main" station. The line to Domodossola has the quaint name FART, for Ferrovie Autolinee Regionali Ticinese.
Assuming you catch the 1249, then the rest of the trip has reasonable time for some of the more scenic options
Arrive Domodossola at 1436. Take the next train to Brig, where you will make your next decision.
Depart Domodossola at 1448, arrive at Brig at 1516. There are two stations in Domodossola...I don't remember the details, but probably you have to walk a few minutes from where you get off the FART, and get to the mainline station northbound through the Simplon Pass/Tunnel.
Arrive at Brig at 1516.
Here you have two routes to get to Spiez, on your further way to Luzern ( which continuing route may go through Bern (faster)or through Interlaken and Meiringen on part of the slower and more scenic so-called Golden Pass Route, in a train named the Luzern-Interlaken Express.
The choices have time consequences.
Let's pick the longest and most scenic route over/through the Alps first.
Of the two routes from Brig to Spiez, the very scenic route over the pass through Kandersteg is my first choice. Leave Brig at 1536 and arrive at Spiez at 1644, riding the train named Lötschberger (which continues quickly thereafter to Bern if you stay on the train at Spiez).. Thence from Bern to Luzern is the quickest option after the high route through Kandersteg. Continuing from Spiez to Bern on the Lötschberger gets you to Bern at 1720. Thence to Luzern, departing at 1734, arriving Luzern at 1855 with change at Olten.
You could also grab a snack in Bern and catch the direct train leaving at 1800 instead of 1734 arriving at Luzern 5 minutes later at 1900.
Or, if you are tired of looking at scenery, and want to see the inside of a tunnel, leave Brig at 1520 via Visp and the new Lötschberg "basis " Tunnel, arrive at Spiez in 33 minutes at 1553 having looked at the inside of the tunnel.. That earlier arrival time gives you some options ... you can go on to Bern and then Luzern arriving as early as 1755 or 1800, depending on trains chosen
So, the very fastest return gets you to Luzern at 1800 and skips a lot of scenery.
The longest route is to go from Brig over the top via Kandersteg, get to Spiez at 1644, change trains and go at 1733 (40 minute layover) to Interlaken Ost, pick up the scenic Interlaken-Luzern Express, and without my describing all the details, arrive at Luzern at 1955.
You will have a long day, so you will be able to choose routes at the end of the trip to go more scenic or fastest. I really recommend that you take the Lötschberger via Kandersteg. After that, it is trade off of your tiredness and speed vs. scenery.
If you don't follow this extensive detail, get out a map, and the time table. The map in particular will be useful.