Civcrm Refund - why are amount and fin. type are based on (priceset) rather than line_item?
Your modification is almost certainly correct.  

Line items are an area of the code that was traditionally weak, but have come a long way in the last year.  My recommendation is to submit a bug report on issues.civicrm.org, and your patch on Github.  The review process means that this question will be answered by the financial experts. Financial improvements are generally reviewed pretty quickly.