It started off as a joke in my RPG Maker VX engines, mostly as a tribute to the Touhou games.
In those games, there were four difficulties: Easy Mode, Normal Mode, Hard Mode, Lunatic Mode and I labeled parts of my scripts based on their difficulty to use. Easy mode was plug and play. Normal Mode required minimal effort like putting in notetags. Hard mode would require you to modify the module to fit your tastes. Lunatic Mode basically gave you a lot of control provided you know coding. The joke tribute came in when I made a little script for damage formulas that allowed for custom damage formulas and I named it Lunatic Mode in the script.
Somehow, the joke kept recurring and Lunatic Mode became really popular with the hardcore crowd of RPG Maker. The freedom that Lunatic Mode that provided was something users at the time ended up wanting in every other script so that scripts can be used to their full extent by casual and hardcore users alike.
Never did I really intend for the term in the beginning to catch on like that though.