Now, if your function is sufficiently complicated, the compiler may choose to not inline it anyway (with the definition of "sufficient" being compiler-dependent).
It could be considered a compiler bug that a function with a static variable in the body could be inlined. As you say, that changes the behavior of the function. Or perhaps it could be considered a specification error - I don't know if the standard prohibits inlining in this circumstance, but perhaps it should.
In a template tracking usage of the class is a common case. Another fine one would be to count separate instantiations. (How many times the function was used not inlined vs inlined.) Etc.
(functions are by default extern, so, unless you specifically mark your function as static, this applies to that function)
What the OP did should be fine and not cause an issues. The only way it could cause issues if they also made the function static.
If so, then it's a compiler bug, and I figured it out because the compiler did what I naively expected, rather than what the standard said.