Nobody knows for sure, the matchmaking is done entirely on Nintendo’s servers which even dataminers don’t have access to. All we know are the inputs it takes, which are letter rank and internal MMR. There are things we can assume from watching how it works, like that it does not strictly match you with people from your letter rank, and that rank-up battles combine your internal MMR with the next letter rank up.
X we could probably figure out, if enough people in all-top-500 matches gave me enough data, I could cross reference that against my massive database of Top 500 over time. But for now, it’s also a mystery. Only thing that is apparent is the edges of the matchmaking (1900/2000) the quality of matches becomes extremely erratic as the system struggles.