I am building a bicycle trailer that i would like to have its own braking system due to its weight. I'm wondering what the best way to accomplish that would be.
People have come up with their own inertial/surge trailer hacks. Google is your friend here. On stackexchange is a related question: How to build surge brakes on bike trailer?
As far as I know, there's no commercial solutions. Part of this is the technical difficulty of braking both trailer wheels equally and in proportion to the main braking force. It's conceivably easier with BoB style single wheel trailers but most trailers are dual wheel with single-sided hubs, which adds further complexity.
Then there's the liability issue. Any time you add new technology, the manufacturer has to assume some liability on its use. Trailers in the USA are most often used to carry children and no manufacturer is going to go near there on that at a price point consumers are going to swallow (i.e., the only way you could upsell a $200 feature like trailer braking is to say it's safer but your lawyers won't allow you to say that).
The DIY solutions are quite ingenious so I'd suggest exploring them. The increase in the number of tandem hubs with disk brake mounts is making it easier to do this. See related question above.
As far as electronic solutions using ehubs. This is non-trivial. Cars can do this as the motor controller can read both steering input, brake input, wheel ABS sensors, and gyro sensors to apply the right amount of deceleration torque to each wheel for maximum stability. Doing this on an ebike or e-trailer isn't impossible but hard to do reliably at a reasonable price point. If using an ebike, note each hub motor alone is $150+.
Many of us who pull trailers use ebikes and as long as your ebike motor is sufficient and you have good brakes on the ebike, and you follow reasonable speed and load precautions, motors and brakes on the trailer seem like just another point of failure (and place we have to recharge).