Short answer : money.
Longer answer:
Inquiring at Google Contracting Services and doing some back of the envelope math, I came up with the following price ranges for the mentioned insulation types.
Spray foam is about $0.15-0.21/square foot/R
Fibreglass batts are about $0.03-0.07/square foot/R
Rigid foam panels are about $0.10-0.15/square foot/R
As we can see, in terms of insulation value for your money, the batts take a bat to all challengers.
Now someone will look at an insulation value chart and says "But foam has a higher R-value per inch, so it's better insulation since you have non-infinite space to put it in".
Comparing insulation value per thickness, they are correct as shown below:
Spray foam - ~R-6.3-7/inch
Fibreglass batts - ~R-3.1-3.3/inch
Rigid foam - ~R-5-6/inch
Both of the more expensive options achieve more with less thickness, so those options would allow more insulation value to be packed into the same volume.
But, you're going to bang your head into a point of diminishing returns where you'd achieve more energy savings putting the money towards improving things somewhere else, and you'll hit that point sooner than you think, given the way R-values work*, so that increased insulation density doesn't really get you much gain.
Additionally, installing batts (and rigid foam, for that matter) is a pretty simple DIY job and requires minimal PPE (gloves, goggles, dust mask). Spraying in foam indoors means you're going to need a full-body suit, gloves, goggles, respirator, etc. which makes DIYing it outside the skill/comfort level of many, meaning needing to hire a professional to do it for you (and the hassle/expense/loss-of-pride that entails), leading people to just go with the simpler batts.
*expanding, R-value basically means that 1/Rth of the heat (or cold, as the case may be) will escape compared to no insulation. R-6 means 16.6% of the heat is getting out. adding R-24 of insulation and going to R-30 results in only 3.3% getting out, a saving of 13.3%. But add another 24 to get to R-54 only gets us down to 1.85%, a saving of 1.45% for the same investment, and as I said above, you can likely find somewhere else to improve things that will get you more than that small savings for the same money, or at an endpoint, that money will buy you more gas/electricity than the extra insulation will save you over any realistic timeframe.
There's a sizable difference in how "tight" (well-sealed) you'll get a DIY installation, even with the tape and GreatStuff in your calculations, vs a proper closed-cell foam spray job. In most homes air movement is as big of, if not greater, culprit for heat loss than passive heat loss. So if the cost of DIY is even close to a pro job, then the pro job will pay for itself in spades.
However, 2" of foam is below what's required for code here in Illinois, if that's all the insulation the wall would have. So check on that. It's important you get the right amount of foam... if not then you can build up condensation on the inside of the foam and end up with mold. There's a lot of misinformation out there about this, so the simplest solution is to just make sure you follow code.
Also, make an effort to check up on the contractor. According to the experienced guys who did my house, if the two components of the foam aren't mixed just right, the foam can either not work correctly or spontaneously combust while curing. I'm sure the latter is rare, but the former would be undetectable to the naked, untrained eye, I would imagine.
Best Answer
The foam isn't the issue, but a lack of spacing can be
Foaming NM cables into a wall (or otherwise burying them in thermal insulation) isn't considered to be an issue, provided that the cables were originally run in a manner that maintains proper spacing between them. However, not all installers are that careful, and for those who aren't, they find themselves staring at the third paragraph of NEC 334.80:
This covers the issues with mutual heating that you allude to when the current-carrying conductors are actually adjacent to each other, such as when a bunch of NM cables are run together. However, with the cables spaced out properly, they will sit separated by thermal insulation, which prevents the cables from heating each other up.