OK, I understand now about the Nutshell transportation. You can certainly do as you intend. I can't vouch for onward transportation from Voss to Odda and from there to Stavanger, but I assume you've checked on that.
I'd recommend buying the Flamsbana ticket ahead of time in case there's a large cruise ship in port the day you want to take that trip. It seems that everyone passing through Flam or Myrdal wants to take that train. I don't know whether there's a need to buy the Flam-Gudvangen ferry ticket early. The mainline train between Myrdal and Oslo can be less expensive with early ticket purchase and can be quite full. I don't know for sure about the western segment of that trip, the part you'll be on west of Myrdal; it's not as busy, and I'm not sure the rail fare on that part is variable.
The coastal scenery in Norway is beautiful, definitely worth seeing. However, you have to balance that against your desire to have time for hiking in southern Norway, which will also be scenic (as are the fjords). Norway has lots of great possibilities. Do keep in mind that the weather in western Norway tends to be wet. Though June is one of the driest months of the year, it rains ten days that month, on average. Very rainy weather can affect views significantly.
Fares on both coastal ships and flights are demand-sensitive and are likely to be lower if you buy your ticket earlier. The flight will probably be a lot cheaper than the ferry if you want an overnight cabin on the ship (which I certainly would, but some folks manage to sleep sitting up). But Norwegian hotel rooms are pricey, so some of the extra cost of the overnight coastal ferry will be balanced by not needing a hotel room that night. Overnight cabins on short segments are only available if they haven't been grabbed by people taking the full cruise. I wouldn't want to wait too long before booking a cabin if you decide to sail rather than fly.
Bergen is a lovely city, worth multiple days of exploration, so arriving earlier by plane has the advantage of providing more time at a highly desirable destination. You might like to go up the Floibanen funicular or the Ulriken643 cable car and hike at the top. The views are said to be very good, and I think perhaps you can hike between the two lifts, making a sort of loop trip.