Short answer: four defaults keys stop the Dock being resized, moved, emptied or hidden. They are stored per account, so on a family Mac with separate logins they have to be set in each one.
Screen Time will not do this. It controls which apps can be opened and for how long, and has nothing at all to say about the Dock.
Every other version of this problem is about a machine strangers use. A family Mac is the opposite: the people changing your Dock live with you, they are not doing it on purpose, and you cannot exactly revoke their access.
Which changes what a good answer looks like. You are not trying to win. You are trying to make Tuesday look like Monday.
Screen Time and Family Sharing are Apple's parental controls, and they are good at what they cover: which apps can run, for how long, what content is allowed, and when the Mac goes quiet at night.
None of that touches the Dock. There is no Screen Time setting for the Dock's size, position, contents or auto-hide. The two solve different problems and work fine together, but one is not a substitute for the other.
defaults write com.apple.dock size-immutable -bool true
defaults write com.apple.dock position-immutable -bool true
defaults write com.apple.dock contents-immutable -bool true
defaults write com.apple.dock autohide-immutable -bool true
killall Dock
Each one grays out the matching control in System Settings, so it cannot be changed from the interface at all. They survive a restart, a sleep and a macOS update.
They are stored per account. That is the part people miss at home. If the family has separate logins, running these in yours does nothing in anybody else's, and each account needs its own pass. If everyone shares one login, once is enough.
To release one, remove the key rather than setting it to false:
defaults delete com.apple.dock contents-immutable; killall Dock
Every key with its type is in every Mac Dock defaults command.
If the Mac currently has one login that everybody uses, giving each person their own is the larger fix, and the Dock is only part of what it settles: separate Desktops, separate Downloads, separate browser history, separate everything. The Dock then stops being a shared surface at all, and each person's stays as they left it.
The cost is that you configure the locks more than once. That is a smaller cost than it sounds, and it is a one-off.
There are two ways to hold these settings and at home only one of them is right.
If you want the middle ground, Still Dock can require Touch ID to turn a lock off, so it is not something anyone passing the keyboard can casually undo, and it is still one fingerprint away for you.
macOS adds a section of recently used applications to the right of the Dock. On a shared login it fills with whatever the last person opened, and it changes every day whether or not anyone touched anything.
defaults write com.apple.dock show-recents -bool false
killall Dock
The four locks do not remove it. It is a separate setting, covered in how to stop recent apps appearing in the Dock.
No. It stops the Dock changing. Restricting what can be installed or opened is Screen Time's job, and the two are fine together.
Yes, if the family has separate logins, because these are per-account preferences. A profile pushed by an MDM can cover a whole device at once, but an MDM in a house is a heavier tool than the problem deserves.
With the ordinary locks, yes, if they find the Terminal commands. With a profile, not from Terminal, though it can still be removed on purpose in System Settings. Neither is a safe, and neither is meant to be.
No. They live in the account's preferences rather than in the system, so an update leaves them alone. They also survive Migration Assistant to a new Mac.
Anything set in one login does not appear in another, so set the locks in the accounts your family actually uses. If an account is one macOS clears between sessions, the settings go with it.
The commands are identical, the situation is not. See a classroom Mac, a library or public Mac, or the shared Mac guide for the general case.