Clarification: depending on your location, rules and laws regarding recommendation letters and references might vary. Make sure you check in your jurisdiction how this works.
I think you're overthinking this. They are almost completely unrelated things. There are various reasons why they wouldn't give you a raise, but from not giving you a raise to not providing a reference to a future employer there's a huge gap.
Go and ask for a raise, always justifying why you deserve the raise and not why you want it. If you don't get the answer you expect, start looking for a new role. When it's time for your new employer to check your references, ask your manager if they would be happy to provide one.
As you can see in my answer, I considered a recommendation letter and a reference check similar in this context. If, for some reason, in your particular industry or location you need recommendation letters to apply for a new job, let me know and I'll update my answer.