I've been having the same problem since the end of June.
In my case, the request below also gives a 504 error.
GET - https://graph.microsoft.com/v1.0/users/{userPrincipalName}/onenote/notebooks/{notebook-id}/sections
I've been running the same process for a long time, but suddenly an error started to occur at the end of June. So far, I've had no problems with exactly the same process.
Also, there are user accounts that have errors and accounts that do not, but even if there are no errors, the API response will be very slow.
I tried the above countermeasure (adding $select etc.), but the same error occurred and there was no effect.
After checking a few things, I found that
If you do not specify a {notebook-id} like /onenote/sections", an error will not occur and the processing result will be returned.
but,
If you specify a {notebook-id} like /onenote/notebooks/{notebook-id}/sections, an error will occur with or without $select.
Prior to the end of June, the same process/same account did not have this problem. From the above answers, it seems that there is some kind of problem on the upstream server side. Please let me know what workaround I should take until this issue is addressed.