What if Yorick just went about his duties with the tiny Hamlet on his back?
If he just wandered around the castle, making his jokes, not paying the child any special care – just treating him as if he were a part of his own body.
I imagine it might make a kid feel very comfortable – the act of pretending invisibility, the joke of being the jester’s hunch or a backpack that occasionally got heavy or pulled his hair. I can imagine a royal child giggling quite overwhelmingly at being ignored or treated inconsequentially – or just as an invisible witness to all kinds of foolery.