I'm not sure if there is a toggle for this but I don't feel like there's much point anymore to preventing resting with hostiles nearby. It seems to only to cause issues when there are hostiles monsters in adjacent "pocket" areas next to yours but not actually physically near you and to prevent that requires making all areas massive.
There is also a long and well known exploit of people hostiling stealther enemies and mashing their rest hotkey to see if they can't rest which indicates if they are nearby, removing this restriction on resting would remove this potential exploit (sometimes unintentional).
Yes, please remove.
Yeah if this is possible it'd be great to remove.
I think this is hardcoded.