Another way of reading the federal statute is that if a state provides in-state tuition to an alien not lawfully present, then it must provide in-state tuition to any US citizen or national without regard to in-state residence.
IOW, what is "the same benefit"?
It is obvious that the Texas law was written to circumvent federal law. By just using a residency requirement and not mentioning "illegal alien" or the legal status of those receiving the benefit, then any citizen from another state could qualify using the residency requirement.