
Trans people have existed for centuries, despite colonization, trying to eradicate any culture that has any gender nonconformity outside of THEIR designated two genders has failed because trans people still exist in every culture, and gender as a concept has existed for a long ass time, but race is a made of concept that colonizers made.
One of the main things is that race is more of an external social categorization than a self-identifier. You are assigned race based on your ancestry, which you cannot control. Race often coincides with culture, which is more mutable. You can assimilate to and join another culture if you so choose.
In our society, gender tends to be a social role that impacts how you are referred to, who you date, and what you wear. So it’s different and more relevant to someone’s personal feelings than whoever they were born to. Plus as the others have said, gender dysphoria has scientific backing.