Avoid compiling regexs in AR::Base.respond_to?

Caches the patterns of ActiveRecord::DynamicMatchers in a class instance
variable.
Merge pull request #11971 from freerunningtechnologies/dynamic_respond_to

Performance regression in AR::Base.respond_to?