Sometimes Trace can provide some insight.
In:= Trace[D[Log[x^2], x]]
And D is correctly using the chain rule.
And ' appears to be operating on Log, turning that into a function that takes the reciprocal and then applying that to x^2 without using the chain rule.
If you read
really carefully and generously assume that what Mathematica was doing above "was right" then you might be able to interpret
f' represents the derivative of a function f of one argument.
as meaning that Log' turns the log function into the reciprocal function.
Then following a function, almost any function, by [x^2] then means you want to have that function operate on the x^2 and give you the result.
So from all this you might be able to understand how you got the result in the second case, even if you would never have imagined that could be what would happen.
Interesting and strange. Good find.