Union of coplanar faces sharing an edge

You’d have to erase the sharing edges - there is no explicit method for this. This means that if the faces aren’t truly co-planar they will be lost. Make sure you calculate the best fit plane for all the vertices and then check of all of them are on the plane. Comparing face normals will yield inaccurate result - something which I’ve seen people frequently do.