The single worst application for electricity is dockside. Thousands of people die every year when a shock that might not kill them stuns them, and they drown. Typically this can't be distinguished from regular drowning, even in an autopsy. The giveaway is that multiple people drown, often rescuers. As such, dockside power is serious business and not to be trifled with.
Keep in mind: dockside power is not "perfect except for you". There are obsolete installations, negligent marina owners, and lots of idiot boaters who are hacking things just like this. Some guy on the other end of the dock doing something else stupid can interact in unexpected ways with what you're doing, and blam, somebody's dead. What will your defense be? Claim he violated the electrical code?
On the other hand, transformers are a "force for good" in dockside electrical safety. Electricity wants to get back to source, not ground, and transformers break "source" into zones.
The best way: Pay your dock to install the power you need.
This is best because of liability. A dockside drowning will bring lawsuits, and if there's any code violations, good chance it will bring criminal charges as well. You want these to be somebody else's problem. You want to be doing nothing more than plugging a boat that was professionally inspected, into a dockside receptacle that was professionally installed and is owned by someone else.
The transformer approach
This is a bad idea because of the liability issue. If you botch this or if something goes wrong, you could face civil and criminal liability. So I would not consider it without a sign-off from both your AHJ and your insurance company; and also having a professional engineer certify it (which shouldn't be too hard).
Even if you do everything perfect and to code, someone could still be electrocuted by the idiot two docks over. And if he can coverup his codevio, and there's your obviously homebrew/hacked together transformer setup, it won't matter if it's code-perfect, their lawyer will spin it around and put it on you. "Preponderance of the evidence".
You are correct that you can merge two power sources using a transformer, but you shouldn't. Because power moves both ways through a transformer, and if one side is energized, it will "light up" the other. That can have huge impacts to safety. For instance if they are sourced from two different panels or services, you have now biased those services against each other, creating current loops in unexpected ways. Doing this dockside is the act of a murderous sociopath, because anything can happen with dockside power!
Then there's the ordinary problem: you would actually be backfeeding from source A to source B or vice versa, and that's bad for exactly the same reason it's bad with generators.
What you can do, however, is use a transformer to take ONE of the 120V/30A circuits and kick it up to 240V for transmission to the boat, then have a second onboard transformer to turn the straight 240V into 120/240 split-phase for the boat proper. A 5 KVA transformer should suffice and those go for about $100 used. You would not be able to use all the burners on the stove at once.