You should be guided by your mechanic’s quote for either outcome. In some cases, solenoids are relatively cheap to buy and don’t require too much labour to replace. But, depending on the vehicle, they can also be very expensive and require more or less a full transmission strip-down to remove and replace. You also need to assess the condition of the whole transmission as putting new parts into a worn gearbox will only delay the inevitable.