Is it a good idea to replace my 3900X with a 5800X3D and my 3200 MHz CL14 8x2 GB kit with a CL16-19-19-39 16x2 GB kit?
Usage is mostly gaming.
I am planning to stick to AM4 for quite some time and it seems that DDR4 memory will soon go extinct.
5800x3D is current the best CPU for gaming unless you plan to get top-end CPUs like 13th gen i9. few things to consider - get this CPU if you plan to get high end GPU. no point getting such CPU and you are sticking 3060 equivalent or less. Ryzen 5 and such CPUs are enough for those.
for memory - it really comes down to your usage, for just gaming 16GB is enough but if you do rendering or lot of multitasking where you don't like to turn system resources off then more ram is better. In 2 years ddr5 will become the new standard so your 32gb will not be used much unless you don't plan to upgrade for 4-5 years.
DDR4 will not Die anytime soon - I recently, on July upgraded from my 8-9-year-old PC which was on ddr3. so I believe a lot of people are still on ddr3 and will move on ddr4 as it becomes cheaper when ddr5 becomes more demanded.