You said it yourself: GitHub users can use GitHub projects on GitHub. Git submodules stay on GitHub, so it's allowed.
> you grant each User of GitHub a nonexclusive, worldwide license to use, display, and perform Your Content through the GitHub Service and to reproduce Your Content solely on GitHub as permitted through GitHub's functionality (for example, through forking)
You can run the code on GitHub Codespaces & GitHub Actions, you can fork the code to make changes, and you can dynamically link/embed the code in other projects on GitHub through git submodules.