engblom said:
The frame is aluminum, so it is not very easy to weld (at least not for an amateur like me) and sadly, my funds are not enough for getting a new bike without some heavy sacrifices and even if I would squeeze out some extra funds I rather put that into a higher quality motor than into a new bike.
The picture you've posted shows it already has v-brakes on the front wheel, so it doesn't really matter if you have or use the coaster brake. If you post a link to the exact bike you are going to buy (or already bought) then we can verify that in it's specifications.
AFAIK the only thing that makes a CB hub incompatible with a middrive is if you want to *use* the coaster brake, because the drive will keep pushing forward and the freewheel between the pedals and the wheel will prevent the CB from being operated.
If for some reason you simply must replace the CB:
The coaster brake hub is probably 100 or 110mm, and could be replaced by a 3-speed IGH, with cable-brake. To verify the width, you would need to check the bike's specs on the manufacturer / sale page, or take the rear wheel out and measure the space between the dropouts.
If the spoke flange holes in the CB hub are at the same distance from the center as those in the IGH, and the spoke flanges are the same distance apart, then you can even reuse the same spokes to lace the IGH into the original wheel (but a bike shop that can build the wheel for you can make new spokes cheaply enough, usually a dollar each or less).
Or if you are willing to disassemble the CB hub, you could remove the brake shoes and reassemble it, so that it won't brake when pedalling backwards, if that is a requirement for your middrive.