Replacing mesh collider with primitive colliders via script

How would I go about splitting a mesh into box colliders to remake a complex mesh collider with primitives via script in C#?

There is no easy way to 100% replace a MeshCollider with primitive colliders. However there are solutions which approximate the mesh with primitive colliders on the assetstore.