The phrase "quit while you're ahead" is typically used in a positive context to advise someone to stop doing something at the point where they have already achieved success, before they potentially lose that success by continuing to push their luck. However, in the context you have provided, it is being used sarcastically and insultingly to criticize the person's goals and suggest that they have already failed or are unlikely to succeed in achieving them.
In this case, the phrase "quit while you're ahead" is being used ironically to mean the opposite of its usual meaning. It is suggesting that the person has not achieved any success and should give up on their goals altogether. It's a way of mocking the person's efforts and implying that they are foolish for continuing to pursue their dreams.