For the 1 year anniversary of this patch, D5577, which added these buttons, just
in a technically incorrect way, I decided to implement this as a template.
The original reasoning from @William Reynish (billreynish)'s patch:
Currently it's a weak point in Blender, that users cannot access the object dimensions
more easily. Currently we hide this inside the 3D View Sidebar. For such a basic
and useful concept as setting the dimensions, I would like this to be more apparent
in the UI, and also discourage opening the Sidebar just for this one item.
Additionally, this patch reuses the template for the N-panel dimensions buttons.
That code was a mess in my opinion, it called the same function with different
arguments for adding the buttons and applying the changes.
There is one remaining issue: multi-drag doesn't work properly for these buttons.
I still need to investigate that more, but maybe it's obvious for someone more
familiar with that system.
Just joking about the anniversary thing, I just noticed that now