If the codes you write in the question are accurate, then that’s your problem right there: the Unicode character U+0027 is not a prime. It’s a simple, typewriter apostrophe, and the setting mentioned in Wolff’s answer is likely responsible for them being changed into curly apostrophes.
The correct code for a prime is U+2032; this character is never interpreted as an apostrophe or quote mark and never changes, regardless of what you have your Use Typographer’s Quotes setting set to.
Note that U+0313, which you mention as being an apostrophe, is also a different character: it’s the Combining Comma Above, which is used, among other things, to indicate smooth breathing in Ancient Greek. Crucially, U+0313 is a combining diacritic, meaning that, unlike apostrophes and letters, it doesn’t take up any space on its own, but is instead placed above another character without (usually) affecting the width of the base letter.