leibie101,
If we understand correctly, you have Auto-Lock set at one of the lower settings and do not have Attention Awareness enabled, yet your iPhone still does not automatically lock when you lay it on the table and get up and walk away.
It sounds like you've already tackled some incredible troubleshooting. When you erased the iPhone, did you Erase All Content and Settings through the Settings app on your iPhone? If so, do you have access to a computer where you can use iTunes or Finder to restore your device? We're asking because erasing your device through Settings will remove your user data, but restoring with a computer reinstalls the software. This is a great step to try if it's possible the issue is related to the iOS software.
Make sure you have a current backup, and try this:
Restore your iPhone, iPad, or iPod to factory settings - Apple Support
Still not automatically locking? It may be time to contact Apple Support.
Good luck!