We wouldn’t advise mounting anything to the rear of your bike unless it’s designed for it, and only if you have a flat rack or appropriate, recommended bracket. Rear baskets are a specific, shallower shape to sit flat on the back of the bike, whereas front-attaching ones will have the fixings on the back and will sit more vertically. You shouldn’t do anything which will compromise you or your pet’s safety.