Applying for a PhD before or after finishing master's I'm currently working towards a master's in mathematics, and I would like to continue with a PhD. I have good grades and I'm aiming at something equivalent to a first class honours, at a highly ranked university in maths.

The problem with applying for a PhD now (starting next fall) is that I have barely begun work on my thesis, and therefore wouldn't be able to get a reference from my advisor (at least not one that would describe my work on my thesis, the closest thing I'll have to research, and the crowning project of my master degree). I could try to solicit a couple of half-baked references now, send preliminary transcripts and detail my plan for my master thesis, but I feel my application would be much more convincing if I submit it after I get my degree. My transcript would be a complete diploma, and my references would be able to speak to the whole of my work, including the last (and most important) part.

Although this is what I'm inclined to do, it would inevitably result in losing a year. I would be ok with that: I could try to find a job/internship somewhere, prepare my applications with more time on my hands (including prepping for possible interviews) and maybe even work on a couple of independent research projects. However I'm afraid that time spent away from academia might be a big minus for my application, considering that if accepted, I would be starting my PhD at the age of 26, pushing 27 (and although this might not show up explicitly, it would be abundantly clear from my cv). I see that most of my class mates are applying before finishing their master, and I'm therefore also worried that my taking the extra year might be perceived as an unfair advantage to other applicants.

I'm also worried that submitting applications twice might also not work, since being rejected in this round might play against me next time.

I would be very grateful for any suggestions! Thank you :)
As you already noticed, almost everyone applies during the last year of their master's. No one wants you to feel compelled to take a gap year between your master's and PhD. Since almost everyone is in the same boat as you, they will have a similar level of recommendations. This is expected! Your thesis supervisor should still be able to say some nice things about your research aptitude and potential. Apply now!