Transmission are expensive for a variety of reasons.
1. They are complex piece of machinery, full of intricate gears.
2. They have to be strong to handle the engines power (torque) and driver style, plus normally they are meant to last to at least 100,000 miles.
3. Some newer transmissions such as CVT's are a sealed unit not meant to be repaired so they must be replaced. that is always expensive.
4. Transmission repairs are expensive because (coming back to point 1) they are very complex. A transmission repair often requires lots of mechanics time to figure out what the problem is and take out all the pieces and put them back together. Mechanics time is not cheap typically (70-120$ per hour) this adds up quickly!
Top tip: make sure to keep up with regular maintenance to avoid costly repairs or replacements to your transmission. Have the fluid checked or flushed at the intervals listed in your owners manual and you wont have to be someone saying "i hope it's not the transmission"!!!