Hmmm, weird! Maybe this is a permission issue? Again, seems kind of odd if you can just change the extension and have the search find the term, but... 
Also, have tried doing this search with the Spotlight interface (Cmd+Space) rather than in the Finder (Cmd+Opt+Space)?
EDIT: okay, I think I know what's causing the problem here (though I'm not quite at a solution yet). Spotlight uses things called Spotlight importers to index files—they're plugins for different file types. You can run mdimport to check which Importer is associated with a file:
mdimport -d1 ~/Code/phd-code/raijin/raijin.r
2017-10-11 07:10:34.290 mdimport[64679:6461357] Imported '/Users/rensa/Code/phd-code/raijin/raijin.r' of type 'com.apple.rez-source' with plugIn /System/Library/Spotlight/RichText.mdimporter.
mdimport -d1 ~/Code/thesis/index/index.rmd
2017-10-11 07:13:27.475 mdimport[64703:6464693] Imported '/Users/rensa/Code/thesis/index/index.rmd' of type 'dyn.ah62d4rv4ge81e5pe' with no plugIn.
To me, this says that .rmd files aren't associated with any Importer on my system, which probably means that they're not indexed properly. I think we need to find a way to associate them with RichText.mdimporter.
EDIT 2: okay, I can't test this ('cause I have indexing turned off), but I believe you need to add the type read off by the mdimport command into the Importer. Note that this is definite "you could screw up your system if this doesn't work and I have no idea whether it will work" territory!
Open up /System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist. You'll probably need to do it as root since it's a system file, so do this by running:
sudo open -t /System/Library/Spotlight/RichText.mdimporter/Contents/Info.plist
You want to add a new line to the highlighted section below:
In my case, the type is dyn.ah62d4rv4ge81e5pe, so I think the line would be:
<string>dyn.ah62d4rv4ge81e5pe</string>
The type could be different on your system, though (I installed some Quick View plugins a while ago, and that could affect things)—run mdimport on an .rmd file with the -d1 switch to check it (as I did above). I confirmed that a quick test .rmd file has the same type as an existing one.
If you save that, then open up /System/Library/Spotlight/ in the Finder and double-click RichText.mdimporter to re-index, hopefully it should index rmd files now.
I'm sorry that I can't test this! Again, gotta stress: I don't know whether this will work, and it would be very easy to break something here.