Bhutan is the best example I can think of - the 'Dragon King' of Bhutan, Jigme Singye Wangchuck ruled the country for 33 years, and then voluntarily devolved power to transform his kingdom into a parliamentary democracy.
Pavan K. Varma, an Ambassador of India to Bhutan in 2009 describes this transformation in an article he wrote for The Hindu newspaper:
In March 2008 , the kingdom of Bhutan ... became the world’s youngest democracy. An absolute monarchy gave way to a constitutional monarchy, a new Constitution mandating a parliamentary democracy was adopted, and, for the first time, the people of Bhutan voted, on the basis of universal suffrage, to elect a new Parliament consisting of a National Council or Upper House with 25 members, and a National Assembly or Lower House with 47 members.
... The Wangchuck dynasty came to power in 1907 by uniting a bunch of warring chieftains. The fourth king in this dynasty, Jigme Singye Wangchuck, assumed power in July 1972 ... Jigme Wangchuck brought to the throne a wisdom and sagacity that belied his youthfulness and lack of experience ... First, he transferred most of his powers to a nominated Council of Ministers, thereby volitionally diluting the concentration of power in the throne.
Finally, and most dramatically, in December 2005, when he was only 50 years of age, he announced his decision to abdicate from the throne in 2008 in favour of his eldest son, Jigme Khesar Namgyel Wangchuck. This announcement was accompanied by a royal command that work on a new Constitution must begin immediately with the express purpose of converting Bhutan into a parliamentary democracy with a constitutional monarchy.
Why did Jigme Singye Wangchuck ... take these momentous decisions which would curtail his own absolute powers, especially since there was no political restlessness seeking a change of the polity? ... The answer quite simply is that Jigme Wangchuck had the political incisiveness, rarely seen in monarchs, to pre-empt history. He knew that in a rapidly globalising world, Bhutan could not sustain its isolationist path; he also knew, looking at developments in neighbouring Nepal, that sooner or later there would be a democratic challenge to an absolute monarchy. In view of this, he chose to anticipate the inevitable by initiating change himself. - How democracy took roots in Bhutan
"Aside from the prosperity and modernization Pedro II left to the nation, there was also a heritage of political and personal values. Many of his reforms and achievements had become so much a part of the national consciousness that they were accommodated by successor regimes. These formed the foundation for Brazilian democratic ideals." // Wikipedia
– Gnudiff Dec 18 '23 at 12:53