Foam sounds terrible for holding bolts. If you have to fill it and have a clear hollow access, I’d consider epoxy and some wood dowels. The dowels would be to bring the cost down because you will probably need more than a gallon of epoxy and that stuff is expensive. This is my idea, please feel free to poop on it.
I went back to school for engineering in my late 20s. I took physics and calculus again because I needed it to be confident in pursuing the rest of the courses.