If a wheel is completely missing from the car, they will not replace it in the pits, they only fit a new wheel if you have a puncture, not if it´s missing.
So if a wheel is missing but the car is still driveable it´s usually best to stop somewhere in a safe place (like you did near the end) and wait for the race to finish to at least complete the race.
The pits aren´t a safe place to wait in this scenario btw, as you might hinder others at making pitstops.
About the pitstop itself causing you issues:
I assume you have the AI control the car for you in pitlane? It´s better to turn this option off in the Game Options as the AI sometimes is buggy with modded tracks and might spin or cause other issues on pitroad (like you experienced).
Disabling this option lets you control the car yourself and you shouldn´t have any issues with glitches like you showed in the video at 1:02 and 2:08.
My game is in German, but you should still be able to find the option for this: