Custer's rank at the time of his death was Lt Col of the 7th Cav and Bvt Maj Gen.
Custer's court-martial had no effect on his seniority. At the time he was behind Merritt and ahead of Devin on the list of Cav Lt Cols. He was in the same position at the time of his death, except by then Merritt had reached 1st on the list, Custer 2nd, and Devin 3rd. Had Custer lived he would have been promoted to Col of the 3rd Cav. Instead Devin got that promotion.
The deserters he order wounded were in the actual act of deserting. about half the men were actually brought in, three were wounded and one died.
If you wish to call Custer's rank temporary, fine. But do you understand that his rank was no different than ranks held by many officers during WWI and WWII.
The senior officer commanded. As a Lt Col Custer commanded his own and the 19th Kansas Cavalry in 1868 - 69.