Build of UE4Editor on Ubuntu 18.04 fails

I have a very similar system I7 8700, 1080 Ti Ubuntu 18.04 and have been building Unreal Engine on Linux since 4.17.
When first attempted 4.21 build my system reliably crashed somewhere in the big build stage similar to your description.
What did was to disable hyperthreading (you can also try reducing the number of parallel compile jobs - theres an answer on this hub about which Unreal build parameter to change) then it compiles reliably.
It seems if you really are running the processors hard hyperthreading is not good - at least under Linux.
I disabled hyperthreading as also having issues with games running under wine also crashing - and this appears to be another known hyperthreading issue.