Well, yes, your brain cells, which includes all of your cognitive functions, do know the difference in ways that matter to your sexual functioning. For example, it is one thing to supplement partnered sex with masturbation. But someone who only masturbates for many years and never has partnered sex, will likely develop their sexual response a little differently, and possibly to an extent that it would be a real learning experience to actually be with a partner. And this can happen even if the fantasy during masturbation is to be with a partner.

It's like playing baseball. You can fantasize about playing baseball all your life, but if you've never played it, your experience and performance on the field is going to be a lot different from someone who has actually played baseball all his life.