https://github.com/matrix-org/matrix-react-sdk/pull/5327 adds a concept of "customisation points" to keep custom functionality contained. This adds some general guidance on how to use them.