That might help to regulate a heartbeat, but it would take energy away from the heart that could be used to pump blood. If the heart is weak in the first place, then I'm not sure you'd want to to tax it further by making it power its own pacemaker. Better to power the pacemaker by some other bio-electrical source, such as the electricity-generating artificial organ described in TFA.
Then again, if we can just print someone a new "super-heart" then sure, put a dynamo in it and make it power whatever you want. Run your cell-phone, wearable Christmas lights, a human-mobile WiFi access-point, whatever. But how would this compare with other ways to create electricity inside the body, such as the new electricity-generating organ proposed in TFA?