england-and-wales
then what stops private citizens from residing on such structures?
Nothing. Anyone who can be a tenant of a house or apartment can be a tenant of a boat.
The [general framework at a very broad and high level] of legality of mooring semi permanent barges such as the Bubby Stockholm off the British coast, whether for the government or for private citizenry?
The owner must moor it somewhere. If the mooring doesn't already exist then you need licences and/or permissions and/or consents from the relevant authorities/owners to make it. The Crown Estate owns about 50% of the UK foreshore and most of the seabed. There could be more than one authority/owner of the space to be occupied.
On the inland waterways you will need either a permanent mooring licence or a continuous cruising licence.
If you stay in one place sufficiently long you become liable for council tax.
You will either somehow travel to the mooring or (more conveniently) the mooring is near a jetty. Does the jetty already exist or must it be built? Is there additional infrastructure to be built, such as parking, utilities (electricity, water, gas, sewerage), 24/7 security etc? To accomodate 500 people on one vessel you will need more than is required by occupants of a 34ft yacht or 70ft narrowboat.
To lawfully start building things you need the appropriate permissions/consents.
In the case of Bibby Stockholm and Portland Port, the government's position is that the barge is below 'mean low water'. This means planning permission to situate the barge is not required from the local authority - it is outside the LA's control.
But the Mayor in her capacity as a local resident, not her office, claims the additional works such as the utilities infrastructure, exercise area and fences come into the jurisdiction of the local authority's planning powers.