Yes but worth it
Although there is a limited risk of a heart attack
occuring during cardiac rehab, that risk is present at home climbing the stairs or crossing the street.
The risk is limited because the activity is supervised, and the patient is one "panic button" away from immediate cardiac intervention. In other words, if it's going to happen, it'll happen, but at least you're in the right place if it does.