Hi Deeksha
When assessing parallelism, it helps to think in terms of opening and closing brackets, much like a mathematical expression, to check if all parts make sense.
Let me label the sentences as follows:
(A) Ralph likes BOTH THOSE WHO are popular AND WHO are not. (Wrong)
(B) Ralph likes BOTH THOSE WHO are popular AND THOSE WHO are not. (Right)
In (B), the brackets are applied after the word "both", which is to say, it reads as below:
Ralph likes BOTH (THOSE WHO are popular AND THOSE WHO are not).
Here, clearly, the individual items inside the brackets (which form the list) are parallel ("those who X" and "those who Y") in terms of logic as well as grammatical construction.
In order to achieve the same effect in (A1), I must apply the brackets after "those" and not "both", since if I apply the brackets after "both", the items of the list inside the bracket are not parallel. This is illustrated below:
(A1) Ralph likes BOTH THOSE (WHO are popular AND WHO are not). Items of the list are parallel - "who X" and "who Y"
(A2) Ralph likes BOTH (THOSE WHO are popular AND WHO are not). Items of the list are not parallel - "those who X" and "who Y"
(A1) is the only construction which satisfies parallelism. However, the construct "Ralph likes both those" is incorrect as it must be followed by a plural noun and not by the "X and Y" construct as in (A1).
eg: Both these boys are good football players.
Hope this clarifies.