This is not the easiest transition to describe online. Watch this video at the 0:59 mark:
https://www.youtube.com/watch?v=FRzB2-V7dkk. This person (I have no idea who it is) doesn't have great technique, so don't copy them exactly, but the concept I want to pull out, which is somewhat visible here, is the idea of shaping.
When the hand is playing the arpeggio, there has to be a shape to it. What you see is that the hand/arm starts at its lowest point on the thumb, rises to the middle finger, the thumb passes under, and the arm comes back down to repeat the process. In this case, it helps to get the hand out of the way in order to pass the thumb under.
You also need to move your elbow way out in order to get your thumb under without twisting. Really exaggerate it at first.. it will feel uncomfortable. Try putting both your middle finger and the thumb on the notes they need to play--3 on D, 1 on G--and then look at your wrist. Move your elbow out until your wrist is straight and you can play the notes comfortably without forcing your hand to stay in a certain position. Now go a little farther and see if it's more comfortable. Repeat until you find the "comfortable" spot. Yep, that far out.
The last two concepts for a true legato feel, I'm hoping you can intuit. They are more difficult to describe. If the above does not help, I would wait for your teacher, or ask your teacher. It would be worse to learn it wrong and have to "unlearn" it, than to wait a few extra days and learn it the right way. Promise. Because I once had to unlearn 15 years of playing, and I still don't think I'm completely cured.

Anyway, hope it helps.

EDIT: just saw someone beat me to a reply, and want to add just one thing.
Practice them very slowly. With your right hand, while your third finger is still on the D, get your thumb in position on the next G. The "bump" is caused by the thumb not being in position in time. Slow practice really helps with this and eventually you'll be able to speed it up. Also be aware of which direction your hand is slanted. For most keys, it helps to keep the left hand slanted slightly "uphill" and the opposite for the right. This makes is easier to reach under with your thumb. Let your fingers "walk" up the keyboard. (Are you old enough to remember the old commercial for Yellow Pages with "Let your fingers do the walking?)
First, very nice Yellow Pages reference!

What I want to add is this: the lack of legato is caused by two things. The first, you mention expertly. The second would be an early release of the third finger before the thumb has a chance to play. It sounds like semantics, but technique-wise, it's not. Either could be the culprit, so check both.
Some signs of a thumb problem: thumb is out of position, hearing separation between 3-1; thumb enters late on the beat
Some signs of a 3rd finger problem: thumb is in position, still hearing separation between 3-1; thumb enters on-time without rushing to play the note
I don't think your thumb needs to play any "earlier", but that could technically be the case. What I think you really need here is to hold your 3rd finger until the thumb plays. Some of the technique I described above will help you do this. But, like I said, if you're still having trouble, you should ask your teacher. They can sit at the piano with you and go through the motions, where we can only type.
