I admit that the question posted by girish3131 (Why D is wrong?) puzzled me so I decided to do some research on this topic "Inversion of Conditionals". I have the following inputs to give:
Inverted Conditional Sentences always need to be more formal and make the event as less likely as possible especially the hypothetical situations. The sentences with "If" and having a hypothetical situation at hand must be inverted in the following manner to make the situation more formal and hypothetical:
Were Texas to have been a country, it would have had the highest incarceration rate in the world.
Sounds odd though, but this is the formal English in which the inverted conditionals need to be presented.
"Had Texas been a country, it would....." is not wrong but is considered informal English and potrays the event as if it were possible with a blink of an eye. It does not indicate remote possibility.
I will give one more example to illustrate this.
If the police had found out, I would have been in trouble.
You and I would have inverted it in following fashion:
Had the police found out, I would have been in trouble.
Although the above situation seems more likely, to write in Formal English and to mention remote possibility, this situation has to be properly written as :
Were the police to have found out, I would have been in trouble.
For more information on what I have said above, please refer the following links and also feel free to comment on this as I have read this for the first time and like you, I also feel hard to digest this stuff. But this is what grammar is all about (No hard feelings to Grammar Gurus.)
Links:
https://mlag.basicor.hr/inversion.html
https://forum.wordreference.com/showthread.php?t=42635