You’ve got the general gist
You’ve got the general gist of how engines manage octane differences but are grossly exaggerating the effects.
No new car today is ever “sending raw gas out the exhaust.” Ever.
And while higher HP can be had with advanced timing and high octane, the cost of doing so is often unjustified, especially in typical SUV driving.