I would not upgrade to a Ryzen 5900X, not on that X370 board with weak VRM-s. It's the warmest and most power-hungry AM4 CPU.
In your place, I would either swap to a 5700X, a 5700X3D/5800X3D, or upgrade to a completely new platform.
The 5900X is, at this time, a failed purchase since the 5950X is stronger for work while the 5700X, 5800X, 5700X3D and 5800X3D are way better for gaming and such tasks.
With a 5700X you get double the cores of a 3400G, the cores are a lot stronger and it supports faster RAM. It's a huge upgrade.