Hulls are usually stronger than shields in discovery.
And stock freelancer.
And shields don't regen quickly.
And there's such a thing as shieldbusters.
And the fact that you speak of a last resort means it's taken into account that this ship might not make it.
Usually one builds ships to last.
On a side note: the more sophisticated an AI, the more expensive.
Data storage may be a lot cheaper now than 10 years back, but developing a sophisticated AI is actually more expensive. A ship of roughly gunboat/cruiser size running on full auto but adhering to certain restrictions while thinking for itself (because it'll be working independently of you) would cost such a ridiculous amount to have it operate itself, even if you kept the engineers onboard for maintenance/monitoring.
Keep in mind automated machines are not AI.
An automated coffee maker technically doesn't need any programming other than "this is how long you should heat after the button is pressed"
An AI ship needs to calculate a lot of math, distinguish foe from friendly, understand its own position in space (and time).
The math in particular concerns travel, probability, speed, normal enemy behaviour, leading targets, how much of a beating it can still take....
To name an example.
Also, not everyone is a big damn hero like Lt. Walker from the stock campaign...