Foam is, in general, pretty rubbish at 'soundproofing' (though it is good at minimising reflected/echoed sound).
Hence the stuff under the carpets is not foam, it's fibrey matting or tar. The tar is a bit viscoelastic so it simply acts as a damper for vibrations on metal panels (that are purely elastic at the typical frequencies of vibration we're worried about here). Hence the tar stuff dissipates the energy in a different way, arresting the vibration of the panel. This is a way to stop sound being generated by the panels themselves (and to some extent stops the panels propogating external noise).
~
But noise that already exists from outside - engine noise, gearbox noise, tyre+road noise, wind noise) won't be as easily halted by a smear of goo. Hence you need sound insulation. Unfortunately, the things that are actually good at this (layers of concrete, dense polymer) are not really compatible with car construction for mass reasons - although it remains non-coincidental that cars that are heaviest - rolls, bentley, etc. - are also the quietest inside.
~
Materials that are effective at soundproofing in thinner layers tend to be laminated, hence dynamat's structure. However, this serves a different purpose to the tarry layers put directly down onto the body (that stop panel ringing) and one should not replace the other.
~
TL;DR version: You should take up the carpets/green fibrey insulation stuff, put dynamat down on top of the tarry panel coating, then put down the green fibrey stuff and the carpets on top of the dynamat.