How to cut a small cylinder out of a chunk of foam with some precision
I would try to use one of the leather hole punchers in the right size. They come in different shapes, for your use I would look for the straight version. Like in this picture.
There is also a wider version, which can work well.
And if your hole is small enough and near enough the side of the foam, a pliers like tool (as in the picture on this page) may work. The page describes the other shapes as well.

And there is also something called a cork borer, which I have never seen in real life, which looks like it should work.

Those of the tools that do not have a base to them works best when you put a layer under your work, I learned that the end-grain of wood work well but a modern cutting mat may do as well, certainly when you only use hand power and not a hammer to push it through.