I still have my original plant and it too nearly bit the dust. Got to a really nice size and produced hundreds of berries. One year, it started dying back bit by bit to the point where there was nothing left but 8 inches of trunk. No branches. No leaves. My wife kept saying "It's dead". But it was still green beneath the bark. Stayed that way for nearly 2 years. Then one day it started coming out of its funk. Not quite as large a canopy as before but still very nice. So unless it is dead dead for sure, don't give up!
I've had multiple experiences like this too - if it still has green, it's not dead. I have had plants that I gave up on and forgot about, leaving them to fend for themselves, and then a year and a half or two later to my surprise find they're suddenly sprouting up from the roots or making new leaves! All is not lost until there's no life left inside the plant. They want with all their being to SURVIVE, so they will keep trying.
I had a lot of experience growing, and even fruiting, plants indoors. Get some pure Neem oil and spray regularly to keep indoor pests like scale, mites, aphids etc. at bay. It smells gross indoors, but it's natural and not harmful - it actually has health properties that benefit humans too. Scale is not going to multiply and end up all over your apartment - the ones you picked off were probably crispy because they were already dead. But it's not normal for your plant to have them on the trunk - that's a pest, not part of the plant. It is very possible that the plant is suffering from several problems at the same time. It's hard to tell from your post, but if the plant started showing problems after you moved it to new soil, then it probably was suffering from some transplant shock. You have to be really careful to preserve the roots and not rip them when you move the plant, and sometimes the change of soil - even if it's better soil - can shock the plant from the change. Also, it's highly likely you don't have enough light for the plant, if you are not giving it a special lamp. Any time you see that a tropical plant likes being grown in shade, that usually means in partial or full sun for colder climates, unless you have a full greenhouse setup. Your miracle plant looks like it's in the shade in a cold climate house, so that's not going to be enough sun. If it's a South-facing window, that will help, but it would do better with a lamp added. Even a full-spectrum bulb from a normal lamp will help plants indoors.
Aside from the scales, I think the other issue you probably have is temperature. You left the house in the winter. So, either you cranked the heat up to help the plant - and made it too hot (I killed a lemon tree I loved like it was a family member by accident when I lived in NY, by placing it too close to a radiator I didn't realize was faulty and got too hot), or you turned the heat down because you were away and it got too cold for the plant. They really don't like temps below 60F. It's right near the window, and with the draft it will feel to the plant easily like close to or below that, especially if the heat is lowered. So it might have lost all its leaves, but then they might grow back if there is still green under the bark. Plus, you might have a had a problem with watering and humidity. Maybe when you were gone it got too dry. People in cold climates and with indoor plants tend to overcompensate by overwatering, which can rot the roots but then the air is also too dry. So that could also be a possibility if you watered a lot before you left and it was sitting in wet soil without enough drainage. I'll bet you anything the air in your home was extremely dry when you were away - so that means the plant had to deal with desert-like air, and miracle fruit wants HUMIDITY. Keeping a bag over part of the plant to help keep some of the humidity and warmth in will probably help it a lot in future, as long as you make sure the container it's in has great drainage at the bottom so it never sits in water to rot or get moldy. You might have also had a problem of poor oxygen-to-carbon dioxide ratio in the air while you were away.
I believe growing these plants successfully indoors IS possible - consider for instance the huge illegal pot industry, so much of which was grown indoors in people's closets and whatnot. You don't actually need a greenhouse if you can't afford one. But using some plastic wrap to help with humidity, some Neem oil to prevent pests, and also using aluminum foil wrapped along the backside of the container facing the window so that light is reflected upward to more of the plant so it doesn't have a dark side, can make growing plants indoors a lot easier and more successful. Then you just have to work out issues of how to keep the soil in the right amount of moisture, and how to keep the temp preferable for the plant but not the rest of your house. Many people find using string white holiday lights wrapped around the plant and the container for the roots makes them happy. Adding a lamp will help too - but usually they prefer SOME hours a day of rest - at least 6.
Growing indoors is a different skill from growing outdoors. It takes different equipment, and to some extent, different know-how. But if you get it down and have the time, it can actually be easier than growing outside, because you have a lot more control and can make different conditions for each plant.
You have two different things going on there - you have scale, and you have buds which may be growing at the ends (can't tell in the picture, but if they're growing and the plant is green underneath, you're all good). You have to brush all the scale off - use a toothbrush with soapy water, and then spray with Neem thereafter.
If you can't save this one, you'll learn for the future. Indoor growing of tropicals takes a lot of patience, and you have to expect some losses in order to learn and build up your knowledge. You'll be even more successful if during the summers you can drag the plant out for some fresh air and partial sun.
A partial list of what I grew inside without a greenhouse: Watermelon, Honeydew, Strawberries, Soybean/Edamame, Amaranth, Lemon, Lime, Okinawan Spinach, Thai chili peppers, Blueberries, Tomatoes, Mangosteen for 2 years, etc. etc....