While I'm not sure how to do this with a macro, I did want to let you know that this is something coming in SOLIDWORKS 2019.
Mates can be grouped into folders based on "status" as explained below.
This screenshot is taken from the "What's new in SOLIDWORKS 2019 Beta" document found here:
What's New in SOLIDWORKS 2019 Beta
It exists and I have a macro vba that orders parts and assemblies, I thought you could make one that also ordered the mates.