I'd say you'd be fine to tow a dog trailer with a class 2 ebike. As long as it doesn't make your ebike go any faster, it should be legal. This is what the law in N.J. states for a class 2 ebike:
New Jersey designates two classes of low-speed electric bicycles:
Class 1: Bicycle equipped with a motor that provides assistance only when the rider is pedaling, and that ceases to provide assistance when the electric bicycles reaches 20 mph.
Class 2: Bicycle equipped with a throttle-actuated motor, that ceases to provide assistance when the electric bicycle reaches 20 mph.
Class 1 and 2 electric bicycles are regulated like bicycles. The same rules of the road apply to both electric bicycles and traditional bicycles.
Dog trailers are even smaller than child carriers. We have people on cargo bikes full of kids, pulling their child trailer full of beach toys and picnic gear each summer. It's the easiest way to avoid beach parking. As long as it's too small for you to ride in, it should be fine.