Are you working with Jira Cloud or Jira Server/Data Center?
When you say you are creating defects "within" the Story, do you mean you have an issue type that is in the Sub-tasks grouping that you use for entering defects?
If so, do you allow other types of sub-tasks to also be created in the Story?
Can you show an issue with an example of Defects "within" the Story, and and example of defects linked with the Story?
When you link defects to stories are you using a link type that you only use for linking defects to stories? Or are you using a link type that might link other types of issues to the story?
Do you have any third party apps that extend the JQL functionality? If not, would you be open to acquiring one?