I have some plastic wheel skirts with holes zip tied around the wheels on my bike with a baby seat to keep the kid's blanket out of the spokes:
https://www.amazon.com/dp/B0C5DHRVLB
Could dip it in a pan of plastidip first, I suppose, to fill in the holes, and zip tie between the wheel and chain. There's lots of solid ones out there for specific cargo bike models, but very few generic.
I tried cargo nets first, but it's tougher to keep them out of the wheels and they stretch when someone tries to poke into the spokes, so I upgraded to these plastic ones.