Sorry to hear of your troubles. I also have a 2001 M54, also did a warped head repair about 4 years ago, also facing new motor challenges and others too. When I had things all apart for the engine work, I took apart the starter for a look, and ended up replacing the brushes assembly (not really needed at all, but I had already bought the part by the time I got in there to see that the brushes had 70% left at ~180k miles).
I'm with @nick325 (as on most things) - would be very cautious about replacing a part like that before careful diagnosis.
Here is a pic of the starter in my car from back when I took it apart. (still working as well as ever).
Some other pics from the replacement. A lot easier of course with the head off. It is held on there with Torx screws coming in from the rear. I have read (and can believe) that the easiest replacement when the engine is all together is to get at it from below. So I'll repeat that this is really something you want to be sure you need to replace before doing it.
And I even found my notes from the starter work:
Starter rebuild. x5 m54 starter wiring: B+ comes from jump port on firewall, goes to starter (solenoid), then terminates at alternator. Control wire is black and yellow, 8mm nut. Other solenoid wire is black, 10mm nut. Removal required E12 with a tight fit. To break loose, used E12 socket on 3/8" breaker (needed due to low profile). Then Craftsman universal 3/8" ratcheting wrench to unthread it. Threads and dowel were in very good shape, but I tapped, cut, sanded, and greased to make any future removal easy (when the intake manifold might still be in place, making it much harder). Took it apart, cleaned, greased. Brushes were only worn down about 30% (13 mm down to a little less than 10 mm), but I bought a new brush assembly (4 brushes) and installed it.
Part numbers:
BMW 12-41-7-501-738.
Bosch PN: SR-0474-N.
On the starter shell itself: Bosch 0 001 108 190. Decoding the Bosch #: all Bosch starters start with 0 001; next 3 digits, 108 are the series of the starter; final 3 digits relate to exactly what type of car it is for.