Muslims are commanded by Allah(SWT) to obey Him and His Messenger without exception:
O you who believe, obey Allah, the Messenger, and those in command among you. If you disagree about something, refer it back to Allah and the Messenger, if you believe in Allah and the Last Day. That is the best thing to do and gives the best result.
Surat an-Nisa`: 59
But I find differences in opinion among scholars on some issues whether it is obligatory or sunnah. Like in the case of shaving the beard:
Ibn 'Umar (May Allah be pleased with them) reported: The Prophet (ﷺ) said, "Trim the moustaches and let the beard grow."
Here the Prophet() is commanding as it seems from the text, but still there is a difference in opinion.
Similarly, the below hadith also seems like a command, but most scholars interpret it as makrooh:
Narrated by Jabir bin `Abdullah:
The Prophet (ﷺ) said, "Whoever has eaten garlic or onion should keep away from us (or should keep away from our mosque).'
So, the verdicts on whether a command by the Prophet is obligatory vary. How is this methodology of usool-ul-fiqh compatible with the Ayat above and other similar ayats in the Qur'an?