i've just found out in this specific example there's a mate in six but otherwise is this perfectly legitimate thing to do?
simplification.

Ra7+ or Qxf7+...both are winning. Who cares if you play perfect moves in these positions? If Qxf7+ will lead you to a faster win, go ahead! :) In my opinion every move is legitimate if your opponent can't get a win or draw with perfect play

i've just found out in this specific example there's a mate in six but otherwise is this perfectly legitimate thing to do?
I'm not surprised there's mate, I think of Qxf7 as lazy, but no, there's nothing wrong with winning that way. I guess I'd only caution you by reminding you're at your best when choosing between 2 candidate moves, not when you're trying to build the case for only one move. So if this were a real game, as long as you compare Qxf7 to some other alternative, then that's fine.
Of course as soon as you look for an alternative you should find Ra7+
But lets say the rook on a1 is instead on c3. Pretty much every human game will continue: Qxf7 and then black would resign.

Possibly of interest:
https://www.chess.com/forum/view/general/please-explain-the-engine-s-analysis-here
a widely known chess tactic is simplification. this where your up in material and trade pieces of however should you lose material to simplify let me show you an example
should white have kept his queen or was this the right decision.