"You can't use 40 short and weak ammo in a 10mm"
This isn't true. Most 10mm handguns will function just fine running .40S&W. The case is the same except the 10mm is 3mm shorter. Also, most modern commercial 10mm ammo is downloaded to near factory .40S&W velocities. I don't know why you would carry a .40 for bear protection but for either the 10mm or the .40 in bear country you would want specialized deep penetration ammunition from someplace like Buffalo Bore or Underwood. Ammunition designed for defense against humans does not generally work well against heavy game as they often do not penetrate deep enough to reach vital organs and will fragment when they hit bone.
Here is an interesting read on handguns used in actual defensive encounters with bears.
https://www.ammoland.com/2024/05/bear-defense-with-handguns-update-20-more-cases-98-effective/
Go through the original and all the update links.
In many cases people stated that from the time they were aware of the bear to the bear being on them was around 2 seconds. Consider the type of holster and where you carry it as well. Most people cannot draw as quickly from a chest rig vs a holster on the hip.
My vote for a survival/bear gun would be a Remington 870 with a 14" barrel and ghost ring night sights. Add a sling and a receiver mounted ammo carrier. Carry different loads for different jobs. Birdshot for grouse/quail, maybe some buckshot and Brenneke Black Magic Magnum for bears. https://www.brennekeusa.com/brands/hunting-ammunition/black-magic-magnum
YMMV
