Yes, you're just about right.
If you check Pupitar's latest Dex entries (The ones from Ultra Sun and Ultra Moon), it says that the following:
"This troublesome Pokémon can’t wait to evolve, so it relieves its stress by wildly propelling itself around using compressed gas."
"This dangerous pupa thrashes about. Its shell is as hard as bedrock, containing its gradually forming new body within."
As you can see, Pupitar is basically Larvitar in its slow evolution stage, but in a shell as strong as bedrock. In the entry from Ultra Moon, it states that it is literally a pupa containing a gradually forming body within.
Think of it like the evolution process of Caterpie to Metapod to Butterfree. Larvitar is the Caterpie, Pupitar is the Metapod, and Tyranitar is the Butterfree (If you can even picture that) The only difference is that Larvitar's evolution group is based off of dinosaurs, and thus Pupitar is much more aggressive than Metapod. Another reason for its aggressiveness is that it literally can't wait to evolve, so it relieves its stress propelling itself around with its compressed gas.
So yes, you're right that Pupitar is a cocoon, and that Game Freak named Larvitar as it is to get the word "Larva"
across. Sure, it seems a bit weird of a choice for a dinosaur to be in a cocoon, but think about it. If Game Freak just made a mid-evolution dinosaur, it would look a bit awkward and not very creative. The cocoon idea really catches the eye, and I honestly think its cool. And sorry this was a bit long...