That exact story is from ancient Indian Epic Mahabharata … story of Janaka and Shuka ~ of course, the original story had much deeper and elaborate message

Paulo Coelho repurposed it for a simple message ~ but both messages are about Balance