This often-stated reason to book on the ship is an "Urban Legend". No ship has ever left Skagway without passengers who were on a WP&YR train. There is only one track - any delay on the line makes everyone late, and that is extremely rare (usually a rockslide, every few years). The advantage "can be" because if you book on the ship, you board at your ship, if not you board 2-4 blocks away - handy for those with mobility issues.
Your statement about single track is true, but it has several sidings where trains going opposite directions can go by each other (called a "meet" in railroad lingo).
When demand warrants, the White Pass & Yukon Route (YP&YR) actually operates separate trainsets as "sections" for each ship, which deaprt from and return to the respective piers, and a "section" for local travellers, which departs from and returns to the station. The "sections" of each scheduled train officially run on the same timetable, but actually run perhaps five or ten minutes apart. At the end of the day, each ship waits only for the "section" that is carrying its shore excursion to return to its pier. If you are on a "section" for local travellers that's behind the "section" for your ship coming down the hill at the end of the day, you may find that the lag between your section and the section carrying the ship's excursion and the time required to walk from the station to the pier will have provided enough time for the passengers on the ship's excursion to return aboard and the ship to get underway before you get to the pier.
It's okay to buy tickets on a morning trip in town, but book afternoon rail excursions through your ship to be safe.
BTW, there's an excellent article about the WP&YR in the most recent issue of Trains magazine. The article notes that the railroad often runs sixteen or more passenger trains to accommodate demand on days when several ships are in port.