A user.js file is handy for configuring Firefox settings, especially for mass deployment and/or to save having to hunt through about:config etc.
As far as I'm aware, you're restricted from setting the search engine via user.js or even about:config, even though you can set almost any/every other setting this way.
From memory it was restricted due to concerns of mis-use.
Hoping we can get the functionality revisited 👍