Ha! It certainly *could* reflect Shakespeare's view. Very few writers like it when actors abandon the script the writer agonized over, and instead say whatever pops into their heads. I know it sounds like I'm stacking the deck there, but some writers are actually ok with it.
Some kinds of theater are built to accommodate improvisation. Del Close / Whose Line Is It Anyway style improv comedy wasn't around then, but commedia dell'arte was, and improvisation was a staple of that, especially in its early stages in the 16th and 17th centuries. There were pre-existing characters and basic scenarios, and even pre-constructed gags (called "lazzi") that could be thrown in whenever needed. If you're not familiar with it, think of a children's birthday party with performers dressed as Marvel characters doing a little routine. It could be a lot of fun, and if Spiderman trips on his web and Wolverine catches him, and they think fast and pretend to tango, it could be even more fun.
But that's pretty clearly not what Shakespeare was interested in. He had stuff he wanted to explore. Even if we don't assume he was all into art and poetry and speaking to people centuries later (which he was: "Not marble, nor the gilded monuments of princes shall outlive this powerful rhyme..."), he wanted his stories to flow a certain way. And FOR SURE, Hamlet wanted the same thing. What if the guy playing Gonzago decided it would be funny to keep moving in his sleep every time the other actor tried to put poison in his ear? What happens to Hamlet's plan then?
By that same token, what if the guy playing Polonius decided it would be funny to hide a pig in his costume and let it out while he and Claudius and Gertrude are reading Hamlet's letter to Ophelia? What if the audience laughed? What if they laughed and forgot what the scene was about? What if they didn't catch that Polonius is spying on Hamlet during "to be or not to be"?! I'm getting nervous just thinking about it, and I didn't even write the thing! Nor am I trying to trick my uncle/step-father into revealing whether my dad's ghost told me the truth about his murder. Hamlet is; can you blame him for wanting his play to go perfectly?
Shakespeare grew up watching traveling companies do plays, and they were mostly bible stories and things everyone was very familiar with. Sticking to the script may not have been quite so important; as long as Noah gets on the ark eventually, it's all ok. But by the time Will grew up, he and his friends were interested in more complex stories and exploring human emotion. He wants you to pay attention to what he cares about, whether it's in Hamlet or Midsummer
tl;dr: it's not necessarily that Shakespeare or Hamlet hate improv in general; they just don't want anyone messing around with their hard work!