Editing Polygon Collider 2D Mesh by Script

Hey guys,
I am working on an isometric 2D terrain generation with which I want to be able to interact with the mouse later.
I am creating all the GameObjects within a script and need the tiles to have a Polygon Collider 2D for the mouse interaction. I am far from satisfied with the mesh Unity creates for each tile and want to edit them manually.
I do know that I could create a Prefab and edit the Polygon Collider there but I want the colliders to be as precise as possible so that there are no holes and no overlaps in the final terrain and the best way to do that is by placing them in a script with precise coordinates.


I have attached an image with three current phases I am encountering. The first kind(left) happens when I create the GameObject with a script and add the Polygon Collider 2D as a component. The second one(top right) is when I throw the sprite into the scene myself and add the Polygon Collider 2D in the Inspector.
And the final one(bottom right) is the way I want it to be only the gras should be seen as a collider.

I have started to access the Polygon Collider 2D component in a script but can’t think of a way check for current placement of the vertices of the collider mesh or how to edit them.

I have found that just using SetPath of a PolygonCollider2D can sometimes behave strangely, especially if you are doing multiple paths. I found that setting pathCount first prevents this chance of strange behaviour.

polygonCollider2d.pathCount = 1;
// firstPath is an array of Vector2's defining all of the points in your collider
polygonCollider2d.SetPath(0, firstPath);

Or for more than one path:

polygonCollider2d.pathCount = 3;
polygonCollider2d.SetPath(0, firstPath);
polygonCollider2d.SetPath(1, secondPath);
polygonCollider2d.SetPath(2, thirdPath);