For an advanced student writing about sufficiently complex topic, the challenge is to develop an argument in less than 5000 words, rather than to reach 5000 words.
And there is a big difference between writing an outline (which is valuable and important!) and actually expressing those ideas fully. The latter forces you to clarify your ideas much more precisely - which is a really valuable experience in exploring and understanding the details of a topic.
In that case sure, the whole exercise is kind of a waste of time, but you could say that about basically any educational method surely? You can take a horse to water and all that...
"I have made this letter longer than usual, only because I have not had the time to make it shorter." - Blaise Pascal
But people who think ChatGPT is great usually aren't capable of reading that far :P
For most interesting questions you could write anything between a few sentences and a full book, depending on how much you develop and defend your arguments, evaluate other possible answers, etc.
The word count is a signal on where on that spectrum you should be aiming.