I feel your pain.
My mountain bike broke the chain a few years ago.
The rear sprockets were also worn, so they needed replacement.
There was no 7-sprocket cassette available anymore.
There was 8-sprocket cassette, but I needed to replace the rear hub.
The rear hub and the lacing job was more expensive than a new rear wheel, so I bought a new wheel.
I decided to change the front wheel too to match the rear wheel.
The handlebar shifter was good for only 7 gears. It was a combined unit of shifter and brake. I had to buy new brake and shifter levers to match, and of course, new control cables. It all started with the chain, and I ended paying up more than half of what the montain bike costed. At least I upgraded the components.... ;-)