
She did approach him because of his status in the first place, but it's not crucial to her. Ilya's smart and resourceful, and she has her whole family on her side in this - if she puts her mind to it, she can end this engagement in some other way.
Rather, Karhan not being the heir solves a much bigger problem down the line - their marriage and Ilya's inheritance. She said she wants to be her own family's heir, she wouldn't be able to do that if she has to marry into Karhan's family. If they married, Ilya's family would either be led by her brother, or be absorbed into the ducal family and disappear.
This isn't a problem for her currently because she doesn't plan to actually marry him yet, and nobody else knows she wants to inherit her family and therefore doesn't question their relationship. But we know how these things go - once she realizes she's fallen for him for real, she's probably gonna wanna marry him, and him being the heir would force her to choose between her family and his.