I found out it was an app called NoSleep that was the cause. I had installed it months ago, but thought it wasn't running because I unchecked the "Start NoSleep utility on system startup" setting. But apparently that only controls the menu bar icon. NoSleep is actually always running, and it was set to prevent sleeping on battery.