How to lock Records AND all Subpanels (especially creating Relationships) for Records with a special Status?

Hello Developers,

We would like to implement the following:
Suppose we have a data set that has a custom field called 'Status'. If the status “B” is selected in this field, then the data record should no longer be able to be changed. This can apparently be implemented quite well with the adjustments mentioned here: enricosimonetti.com/.../

But: How can I prevent relationships from being created or changed for this data record? The aim is to prevent entries from being created or changed in the subpanels of the data set and also to prevent the possibility of linking to the data set from other data sets (is it sufficient to adjust the filters here?).

What are your experiences in this regard?
I look forward to your feedback.

Kind regards.

Martin