If a spool valve is bad on a steering rack can that be repaired or does the whole steering rack have to be changed?

Generally it would be cheaper to replace the unit with a used one from a salvage yard. If the power steering fluid has metal particles in it the pump has failed. At this point the entire system including pump, hoses and rack should be swapped out. The reason is that you can NEVER get all the abrasives out of the plumbing and if you replace just the spool valve contamination in the fluid will quickly destroy your repair work.