You would have to create a completely new brush engine. The way the current ones are implemented don’t allow for any modification at all. Every step, every input sensor, all processing is done in a specific set way and order with no way to inject code and tell the engine to do something different instead.
A more loosely and modular engine was proposed for a node based brush engine and an engine designed that way could easily handle plugs-ins for brushes. That would be a new engine altogether not necessarily a replacement for the existing ones.
Here are a few existing proposals, you can find more with the search