Unity launched in 2005. Electron released in 2013. Still, saying Unity would have been "better served" by using Electron is more than a little unreasonable!
Using a primarily JavaScript environment for primarily C# content sounds like an absolute nightmare to me.
Weirdly, when Unity was first starting out it had this "UnityScript" thing, which was javascript-but-not-quite. Luckily it's mostly been phased out (I don't think newer versions even support it)
Electron is a catastrophic of hog of resources and performance. Electron for mobile game UI would be a disaster!