Not exactly. There are similar ideas, as the film progressed from the Novel to Screenplay to Script to the Screen/Transcript.
In the book, the scene is chapter 25, Sol 505 and 506. It's very different as the book is more expansive with what Mark does. The Sol following the conversation with NASA regarding removing the MAV's roof.
The lunatics at NASA have me doing all kinds of rape to the MAV, but I don’t have to open the hull till the end. So the first thing I’ll do is clear out a bunch of clutter, like chairs and control panels and the like. Once they’re out, I’ll have a lot of room in there to work.
In the official Screenplay released by Fox, the internal monologue is added, but doesn't use Lunacy. Sol 538:
I know what they’re doing. I know what they’re doing. They keep repeating “accelerate faster than any man in the history of space travel” like this is a good thing, like this’ll distract me from how insane their plan is.
Note that the faster than any man bit is new, not in the book. The "Are You Kidding Me?" part before this is new too.
Finally, the actual Movie its changed again, adding the lunacy bit:
Like it'll distract me from how insane their plan is.
Yeah, I get to go faster than any man in the history of space travel...
because you are launching me in a convertible.
Actually it's worse than that because I won't even be able to control the thing.
And by the way, physicists, when describing things like acceleration... do not use the word "fast."
So they're only doing that in the hopes that I won't raise any objections to this lunacy.
Because I like the way "fastest man in the history of space travel" sounds. I do like the way it sounds. I mean, I like it a lot. I'm not gonna tell them that.
This change is similar to the changes made to Watney's character. More wholesome punny adult, less foulmouth sarcastic immature git. For example, earlier in the book:
You know what? “Kilowatt-hours per sol” is a pain in the ass to say. I’m gonna invent a new scientific unit name. One kilowatt-hour per sol is... it can be anything... um... I suck at this...I’ll call it a “pirate-ninja."
Not to forget the Space Pirate part that was kept in the movie.
While the specifics of choosing Lunacy because it would be a space pun are unknown, it's an evolution of existing context to fit the character better.