The character used for the bar in legacy math fonts has a different code in Unicode.
The difference in width is slightly more than 0.00004 millimeters, less than the difference with
pdflatex. The bar is a bit higher, though.
The standard definition for
\mathchar'26 refers to the character in slot octal 26 (decimal 22) in math group 0 (the standard text font). This is the same character used for the macron accent, which in OpenType fonts is at slot
0xAF. Depending on the font it can be higher or lower.
Note that Unicode has a special slot for the Planck constants
U+201E PLANCK CONSTANT
U+201F PLANCK CONSTANT OVER TWO PI
unicode-math will define
\hbar to select the latter.