The concept of gender can exist perfectly with a complete lack of biological sex or sexual dysmorphism, the same way there can exist only biological sex but not the ideology of gender.
For example, even if sexual dysmorphism is the nature of the human race, mostly only english countries have this gender ideology,in many dictionaries you can even find over 600 genders with anything from male or female to people who identify as being victims of gentalia amputations even though they actually have their sex system healthy and never damaged or people identifying as being born with a lack of genitals even though they actually have them up to other genders that simply consists of people that like to dress of a certain color ... that's just how they identify.
But as I said those things happen only in particular countries and cultures.
In most parts of the world people will ask you ''what the hell is gender identity?'' and they will not understand even if you try to explain it many times. Just like some people can't understand the concept of religion or even realize what does it mean to believe in magic or spirituality, while some find it natural.
Gender ideology like religion is not inborn in people but starts with particular fashions, some say gender ideology began only in early 1850's while some say it has roots as old as Ancient egypt but for some reason this concept never fully spread through the entire world.
So it's either something incredibly new or something incredibly old that only few people can understand.
What started the gender concept is today unknown but, I gues, just like everything it could happen that someone simply had this strange idea. Somehow it got a relative popularity and survived until today, just like how a music genres or an artistic culture begins, it doesn't have to have a logical and reason for why it exists, someone simply has an idea and then ''poof'' it comes to existance.
If I didn't explain it correctly , I can mike a kind of funny example.
The goth culture
Goth started as a bunch of people who folowed a fashion of darkness and mistery,today somehow it became something so abstract that it can have any meaning you want it to have.
That's why today goths strungle to divide this culture in hundred of sub-genres to keep it alive and avoid goth from fading away and becoming just an abstrant meaningless idea.
Why does it happen? simply cause we don't have microcips in our brains telling us what goth or any other fashyon is, and everyone interprets it as they prefer.
I believe the same thing happened with the gender ideology, whenever or wherever it began, I think at first it was just a new fashyoned culture, and since not many people were getting the same original meaning of this ideology they started to divide it in hundreds of sub-genders to make it popular across those who don't share the same phylosophy of who started the cult.
That's why I think your aliens can perfectly just decide that one day they want to implement this gender system in their civilizations without a reason at all.
Alien gender ideology can begin from anything, literally anything like music,religion,diets,politics,games or as the example from before someone simply has an idea that pops up inside their head and so on...
Obviously your aliens will have different genders than us, You won't find an alien indentifying with human genders like eunuch or mahu... they won't even have our same concepts of feminine or masculine, as they are on earth already completelly different from one state to another ,they will hardly be any similar in an alien world.
That's Why I believe even if your aliens have a concept for gender it would be so different than anything we know or have ever imagine to not be recognized as gender for us.
Even humans,us that ivented it don't always understand what gender is , you can't expect them(those who observers this alien universe) to find a logic in something that's not even from their world.