Reduce unnecessary unsafe usage in AdaptiveCapacityDictionary (#64617)