that your documented boat is therefore considered US soil even when you are in a foreign country.
Thats exactly what registration DOES NOT do. ( and never did) , the only thing that has that are embassies. Registration ( as regards laws) means that in the absence of anything else ( ie the High seas) , the laws of the country of registration apply,
In foreign countries, the rule
of comity is generally applied, hence a foreign country will in general respect the rules of the flag country. But that is a diplomatic nicety, You are subject to local rules and laws when in another countries waters, except where you can legitimacy claim right of free passage
.( which is purely a UNCLOS thing anyway)