WHY must Universal Analytics code go immediately before the closing head tag?
You can put the code anywhere on the webpage with very little trade-off.
Why google specifically recommend to put it in the
<head>
section?
Because there's a tiny advantage of putting it there - with it in <head>
you can capture users who went away immediately after opening your page.
Why not in body?
You can surely put it in <body>
section and you will only lose a very tiny % of visitors (as mentioned above).
Earlier when the code was blocking, the recommendation was to put it just before the closing </body>
tag so it doesn't slow down the website. The recommendation was changed when the code was made non-blocking. Also, since this code is so widely used across websites, high chance that the browser will serve the js file from the cache instead of actual download.