I previously used craft foam sheets, glued together with craft glue for other projects requiring a custom foam insert. They are dirt cheap, you can get any color you want, and the idea, is you build up the thickness you need, by gluing more and more sheets.
Once glued, weight them down with something flat, and heavy overnight. In the end, you'll likely find that after the overnight squish fest, you'll need to add maybe 1 more sheet again to make up for what squished, but most times, it appears after a day or so without weight, it expands fully again.
I used a metal template, and cut each sheet how I need it, then stack them, so I didn't have to cut a hella thickness all at once.
Give it a shot, worked great for the matchbox size rc cars I used to mess with.