"The" is used when you want to refer to some specific specimen of the kind. eg, when you say "the doctor", it means you are refering to some particular doctor which can be known by the context. It is not used before proper nouns as the name itself can give you enough information.
eg: I met a doctor today. The doctor said that I exercise more.
Now here, "the doctor" refers to the SAME doctor you met. So we have established the use of "the".
Now, America is the name of the large landmass which was found in 16th century. "North America" and "South America" are the proper nouns, names for two continents. So we won't use "the" before them.
In North America, 13 colonies united to form a nation. So they called themselves "the United States of America". The was used as a large no. of states were NOT a part of it. So it was used to distinguish.
Similarly "United Kingdom" could be any kingdom which was formed by uniting two or more kingdoms. So "the United Kingdom" would specifically refer to the United Kingdom of Great Britain and Northern Ireland.
But India is a proper name. India only refers to the country India. You don't need to specify "which India?".
In the case of USA and UK, now, they are proper names but as the names also form a description rather than just the names, "the" is used.