The '77 was a great bike. Much better than the '76 I used to have, lol.
I don't know for certain, but if I'm not mistaken, that same general engine layout and size were used on other years of air cooled YZ125, and also on other bikes, such as the YZ175, IT175 and the early IT200. The much newer RT180 may also be a candidate. It sure looks similar to the early IT175. Yamaha also made the dual sport DT175 and 200 for many years, but not sure how similar those are.
If you intend to trail ride the bike, I'd be looking for a late '70's to early 80's IT175 or 200 motor, or the most recent RT180 motor I could find. If you are lucky, it will be an easy swap.
The YZ175 was pretty rare, so you are not likely to find a donor there.
For track riding, nothing wrong with another YZ125. I think they were air cooled through the early '80s.