If I take a loan of $1000 by agreeing to pay $50 + 10% interest each month what will happen if lets say the value of $1 doubles 4 months after? would I owe more money to the bank?
Are there loans that safeguard those things somehow?
Some loans have a variable interest rate which can protect the lender from inflation and the borrower from deflation. How much protection it offers depends on how closely the interest rate follows the inflation/deflation rate. Most variable rate loans have limits on how much and how frequently they can adjust.
In your deflation scenario, the lender comes out ahead with a fixed rate loan already, since those future dollars are worth more than current dollars. The borrower doesn't owe more dollars, but the value of the dollars they owe is higher.