Not true in regards to Russia / St. Petersburg. Royal did not require an excursion to leave the ship.
If you had proper documentation you were free to go ashore with or without an excursion. Not Royal restricted anything, Russia set the entry rules for their country. Basically you had three choices, you either took a ship excursion and the cruiseline took care of the documents. Guided excursions were allowed ashore without visa by the local authorities. You could also book a private excursion and many companies would take care of the paperwork to get ashore. You could also get a Visa for Russia and having that you were allowed to go ashore on your own without any guidance.
With some countries there could be restrictions, but these are not restrictions by the cruiseline, it´s the visited countries rules that set the possibility of going ashore or not. You simply have to follow those rules.
However from experience I can think of another reason for not being able to go ashore without a shore excursion. Hellesylt in Norway to my mind. It´s the entry to the Geiranger Fjord and the ship only stops there briefly to let passengers with a full day shore excursion ashore that will meet the ship in Geiranger later in the day. Nobody without a shore excursion is allowed ashore there, not even to make a quick run outside to take pictures.
Then there´s technical stops when nobody at all will be allowed to go ashore but those are rare.