If you were charged a small nominal fee for your demand deposits, you would likely say "OK, I'll keep a certain amount in my demand deposit account, and then put the stuff I don't need into longer duration deposits, so I can get some interest."
This would be the right thing, and that money could be safely loaned out at durations shorter than you deposited. You would then be signalling to the market exactly what the demand is for money over time, and it could respond appropriately.
To an extent you do this today: you don't keep all your money in demand deposits, you instead put a lot in the market or whatever. Back in the day, you might have even bought a CD, which is almost exactly what I'm describing, sans the requirement that banks not loan funds they can't guarantee are available for the duration of the loan.
So it's not as crazy as it sounds. It's still crazy, but not as crazy as it sounds.