The whole idea of the yield curve is that you (generally) get compensated for that risk with higher rates. That is why (outside of crises) the yield curve is upward sloping. It follows that if you buy shorter dated T-bills or bonds, the liquidation loss risk you mention is low, and you’ll still usually make out better than with the bank because you’re not paying any middleman.