The most obvious part, both halves of the routine seems like they were most likely scripted by Mr. Drummond. The barb about Milchick's use of language is something very specific to Drummond's relationship with Milchick, and Milchick's half of the dialog is deliberately written to set up that joke. The appendix line is clearly a previously-written corny punchline and not improvised.
The Kier animatronic appears to be performed live by somebody. It responds emotionally to Milchick rather than being a series of obviously recorded lines for Milchick to work around. This opens up the possibility that Drummond is also playing the vocal role of Kier, presumably via voice changing tech, but at that point it could be anybody--whether that means a character we know or not, although they do seem to know Milchick personally.
In the real world, Marc Geller (IMDb) is the actor who plays Kier physically and in voice lines, but the actual character is almost certainly long dead by the time of the show, barring any Walt Disney shenanigans. No doubt, Lumon finds it useful to be able to simulate the authoritative voice of their founder for propaganda purposes.
I lean toward Milchick not being made aware of what Kier would say ahead of time. He has his own lines, but I don't think he knows the founder is about to roast his use of language. That seems to have been a surprise thrown in to upset and humiliate Milchick in front of his staff. If he already knew this line was coming and/or had rehearsed it previously, I don't think he would have reacted so strongly.
I do think Milchick's height gag is scripted. There's too much setup with the "larger than life" line preceding it for it to have happened organically. However, I think Milchick spits the line with 1000% more venom than he was supposed to, in retribution for the previous gag at his expense. If you read Milchick's line in a good-natured way, it sounds like perfectly reasonable, toothless corporate comedy. Milchick just imbues it with a power that Drummond(?) never intended it to have.
Kier's final line, "Thank you for that feedback, Seth," is the only one that I think is wholly off-book. Whoever is on the other end of that animatronic is clearly displeased with Milchick's delivery.