I think this is called an internal rhyme.
Here’s what I found on Wikipedia.
In poetry, internal rhyme, or middle rhyme, is rhyme that occurs
within a single line of verse, or between internal phrases across
multiple lines. By contrast, rhyme between line endings is known as