Replacing the RAM or Flash chips on this logic board requires very specialized equipment and not a DIY'er job. The T2 chip does not deal with the RAM only the Flash (the T2 is only in the 2018 models). Apple uses custom RAM & Flash chips which are not available on the open market at this time, so thats not really an option.
Swapping out the logic board is the only alternative and Apple charges a premium and only permits a direct swap-out (same sized bd). Thus, leaving you to locate a used logic board which will also go for a very high cost and thats is assuming it could be done at all. I'm sure no one has even attempted this given how new the system is