The following is a summary of how I see the situation and many aspects of it, including the inheriting of the title, are in agreement with what has already been said.
It would seem to me that lineages can change direction for many reasons, but looking at what information is freely available on the internet and trying to strike some balance between what probably did happen, what actually did happen and transcription errors I still come up with the thought that because James is a child of the second marriage then any brothers from the first would come in line to inherit the title before he would. In this case, his half brother John and more often than not I suspect the lineage carries on to the eldest living son of the one holding the title.
Electrics Scotland also gives an account of the second baronet, Sir John Dalrymple having been twice married and having 5 sons and 6 daughters. When he died he was succeeded by his eldest son, Sir William Dalrymple, who bacame the 3rd baronet of Cousland. Sir William apparently having 8 sons and 6 daughters from his 2 marriages.
The account notes that 3 of his sons of William, 3rd Bart, by his second marriage were also in the army, but, it was after the death of the third baronet that his eldest son, Sir John Dalrymple, by his first wife, Agnes Crawford, became the 4th baronet.
In searching any family tree there is always the chance of stepping on toes directly or indirectly and I see the biggest issue here is in the partial acknowledgement of descendants of Lieut-Col James Dalrymple. Partially acknowledged because some records, in various forms, still exist and they point towards that relationship.
Understanding what went on at the time isn't always easy as we were not witnesses to the events, but what history does tell us is that relationships and marriages that produced Anglo-Indian offspring didn't always have a relaxed acceptance in some areas of society and people reacted accordingly. However, there were times it was actively encouraged and this url gives more insight:
http://www.aiaiadelhi.org/data/aboutus.aspxUnless documented proof can be found we cannot be sure that James and Moti were or were not married but what is known, from the available records, is that there were children born to James and Moti and that he provided well for them, including an education at a school that his sister Wemyss Murray nee Dalrymple had more than a passing connection with, according to his will.
It would appear that the children had Indian names and that any that returned to England to be integrated in Scottish society had taken on English names.
Now, this is only my personal opinion, but I don't see that the lineage changed direction, it would appear to have rightfully gone to John, eldest son of William, 3rd Bart and his first wife Agnes Crawford and from there to the son of John. What I do see and with much sadness, is the non inclusion of the descendants of Lieut-Col James Dalrymple leaving them, for the most part, with a cloudy ancestry and seemingly, without an official documented line in history.
What does seem clear to me is although it is without a title, Glamis and her mother are descendants of an Indian Princess and Lieut-Col James Dalrymple, who is son of William, 3rd Bart of Cousland and his second wife Ann Philps. It also seems clear to me that having their line as part of that family documented officially would mean a lot to this family.