The two instances of long dashes in the passage cannot be replaced by commas. Long dashes separate the enclosed thought more strongly than commas do. Here the enclosed thoughts are sufficiently separate from the main text to warrant long dashes rather than commas.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.