It sounds like the goal is to ride Swiss scenic trains to focusing on the Austrian Alps will not work.
For your trip, a Swiss Pass is a better option than a 2-country Eurail Pass. The Eurail,passes do not work as well in Switzerland as a Swiss Pass does ( meaning it does not provide as much coverage).* You can buy a ticket from Vienna to Zurich on OeBB for 39 € if you purchase 3 months in advance. Then use the Swiss Pass to cover the journey to Zermatt.
If you wish to stick with the plan outlined, you could cover all with a 4-day Flex pass (Swiss Pass). like this:
Day 1, Vienna to Zurich ( first day on the Swiss Pass)
Day 2 stay in Zermatt
Day 3 Glacier Express to St. Moritz ( day 2 on the Swiss Pass)
Day 4 to Luzern, Mt. Titlis, etc.
Day 5 to Zurich for flight home
However, this is not the best use of a pass ( Luzern to Zurich is inexpensive and no need to cover it with a pass day). And it does not get you on the Bernina Express. You could drop the layover day in Zermatt and spend two nights in St. Moritz instead, using the day there for an out-and -back on the Bernina Express. Or, spend one night in St. Moritz and take the Bernina Express the full route to Lugano and spend the night there. Then head to Luzern--several routes are possible, including lake boats part of the way. These plans would have you using the Swiss Pass four consecutive days and paying for the trip to Zurich on Day 5.
It is also possible to work out a better route as Robert suggests, as heading to Zermatt First has you going all the way West and working your way back. Depending what time your flight departs from Zurich, you may be able to travel from Zermatt to Zurich on .day 5. That journey is 3h 21 minutes and the first train departs Zermatt at 6:37, with arrival at the airport shortly after 10.
- For example, according to this website, you will pay an extra $61 to ride the Glacier Express from Zermatt to St. Moritz with a 2-country Eurail Pass.