My rear MTB tire keeps rubbing on this thing that holds the front derailleur whenever the rear shocks are compressed to a certain amount
I am far from convinced the bike is stock, I would be surprised if any bike manufacturer or seller would ship a bike in this condition, even a cheap BSO. The rear tire is definitely not new, so its probably not a new bike.  What little I can see of the shock it looks out of place (Aircan shock on a cheap looking frame).  I therefore suspect the shock has incorrect stroke - e.g. 210 shock comes in both 50 and 55mm stroke.  A 55mm stoke where a 50mm is require would do exactly this, have the wheel foul on frame components when at full compression. The difference between 50 and 55mm stoke is often an internal spacer so it can hard to tell if the shock is correct just by looking at it.
Ideally find the bike make/model/year, look up the specifications and compare to the shock you have on the bike. If the shock has no measurements, let the air out and measure its length uncompressed and fully compressed to determine its stroke.
If you cannot confirm the requirements for the frame from make/model etc, and the shock is length is a common size with the longer of two common strokes, a shorter stoke will stop the tire rubbing when you bottom out.
If the shock is the correct size, then look at the wheel - its possible the frame is designed for 26&quot; wheels and has had 27.5&quot; fitted (maybe from new). This increases the diameter and would cause the interference you are seeing. You could install a 26&quot; on the rear (Presuming disc brakes) which will most likely solve the problem.
Hacking the frame should be a last resort - however will almost certainly be cheaper than a new shock or new wheel(s).