This question is a tough one . And always difficult for me to answer as I grew up obsessed with the piano so that was never a question that crossed my mind.
I always say to people that you need to have years of lessons before you can get to a level that is competent- particularly with the piano. Using both hands competently and sight reading on two clefs takes years to feel like you are getting a hang of it .
That being said it’s all about a personal measurement . How good do you want to be ? And are you happy to stop learning ?
I trained in my instrument for nearly 12 years to get to grade 8, with breaks in between ,some years doing grades , some just learning fun songs . It’s all about your own ambition.
This is difficult when it comes to children, as they may want to quit, but with many adults coming to me saying they learnt music as a child and quit too early, my advice now would be to keep pushing them (within reason!). If music lessons makes your child miserable,of course stop. Sometimes though I find it may just be the instrument the child has picked which just doesn’t suit them, or the teacher . Perhaps try them on a different family of instruments to make a complete break but still using the skills they have picked up .
In answer to the question however, most people feel around grade 3/4 is a good level to have achieved up to (being able to competently learn on your own, sight read, perhaps compose a little). This level takes different amounts of time to reach depending on each person but again, its all about where you feel is the right time to stop learning- for some ,never is the answer!