Hedging is meant to reduce some unwanted exposure, e.g. to interest rates.
If company A (corporate borrower) takes out a loan with floating-rate loan or issues a floating-rate note (for example, the coupons are Libor + some fixed spread; in a few years it will probably be SOFR or some other risk-free rate + some fixed spread or max(0, RFR + spread) etc) then in fact it already has very little interest rate exposure. If the RFR goes up or down, then the coupon payments go up or down, but they'll be almost exactly offset by the change in the present value of the principal repayments, because the interest rate used to discount the principal repayments will change correspondingly. If the fixed spread added on top of the RFR is wide enough (like 10-15% for a high-yield corporate borrower), then some more interest rate exposure will come from this spread. Hedging this small interest rate exposure is likely to be more expensive that it's worth. If company A wants to flatten this interest rate exposure anyway, then the cheapest hedging instruments (as of this writing) would be exchange-traded ED futures linked to Libor (not interest rate swaps, not forward rate agreements, not any options). if Libor is replaced by SOFR in a few years, then you would some SOFR futures instead. Just calculate the exposure of your debt to the hedging instruments and read off the notionals that you need to trade in order to flatten.
Conversely, if having little interest rate exposure is not in fact what company A wants, e.g. if company A wants to take a view that the interest rates are more likely to go up than down, then the easiest way to get some is to issue some fixed-coupon debt, e.g. take a fixed-coupon loan from a bank. That's not "hedging", though. That's betting on interest rate direction. Also the fixed coupon would reflect the lender's view on the likelihood of the RFR going up, and therefore is unlikely to be any cheaper than a floater.
In the scenario that you described, transaction (2) is not an interest rate hedge. It increases the interest rate exposure, rather than decrease it. If the borrower does not want this interest rate exposure, then the best way to avoid it is not to enter into transaction (2) or to unwind it. Historically (see, for example Jefferson County, Alabama or University of California) borrowers who did something like this often claimed afterwards that they did not know what they were doing and sued various parties connected to the debt orgination.
As long as Company A pays RFR + spread to the bank as loan interest, and receives RFR on the floating leg of the vanilla IR swap, it does not matter at all that the RFR might be low or negative or even that the RFR + spread might be negative. Company A missed the opprtunity for a windfall saving on loan interest when the RFR went down. Instead the IR swap counterparty collected this windfall. Too bad for Company A - better risk management (not "luck") next time.
If, however, the loan interest has some kind of embedded rate option, like Company A pays max(RFR,0) + spread on the loan; but the vanilla IR swap has no corresponding optionality, then Company A may have a good case suing various parties for mis-selling; and can hedge its (non-linear!) interest rate exposure with exchange-traded options on the RFR futures mentioned above.