Those two nations still had the right culture and social structure to build blooming new societies. In this context, with "culture" I don't mean political views or such, but work ethic, and things like literacy, education, etc.
The German car industry wouldn't have been thinkable hadn't the Germans invested a lot of research into building machines in a mass produced way, motor research, etc. Sure, the factories themselves were destroyed, but the engineers together with their knowledge remained.
In fact, there are theories that disruptive events are even helpful for economic progress in the long run because they filter out the lazy elite of rich people while giving opportunities for new ideas to be tried out, and hard working people to rise to wealth and influence.
Sure, but that filtering out means wealth is destroyed and you have to start over. The account resets to $0.00.
Also, these events "filter out" a lot more than just "lazy elite rich people". Plenty of productive rich people and regular every day people are filtered out as well.
Wasn't food rationed and life quality lower in general during the wars? I'm basing this on seeing propaganda of making daily sacrifices for the war but not exactly sure. My general image was that collectively it was an extreme low point in many countries.