For non-'test'/Dummy refund (e.g. Authorize), the refund 'contribution' details for a 'contribution' consisting of 2 line_items (a price and a service fee) are getting assigned the same financial type and total amount (with sign reversed) instead of retaining the line_item values. For example, a refund for an event where the price-set includes an event_fee of $20 and service_fee of $2 should have -$20 for the event_fee and -$2 for the service_fee, and the financial-types not changed. In CRM/Contribute/BAO/Contribution.php, both the event_fee and service_fee amount is set to -$22 and service_fee financial type is changed to 'event_fee' type. I modified the code in (Civicrm 4.7.23) CRM/Contribute/BAO/Contribution.php. Is there a reason NOT to do this?
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.