It's better to update values before any output. So it would apply to all places where Cart is used.
add_action('woocommerce_cart_loaded_from_session', 'check_cart_items', 99, 1);
Search for this action. This is called right after Cart is created. Then you can adjust price for each item in cart. Same way you already are trying.
public function check_cart_items($cart) {
foreach ( $cart->cart_contents as $key => $product ) {
// find attribute for current product
// .. do stuff
$cart->cart_contents[ $key ]['data']->price = $new_price;
$cart->cart_contents[ $key ]['data']->regular_price = $price;
$cart->cart_contents[ $key ]['data']->sale_price = $price;
}
}