Why did the United States sign a security treaty with Japan?

In order to contain these two rivals, territorial disputes between Japan and China and Russia can be used to intervene in territorial conflicts at any time. Since China and Russia are no rivals of the United States, they can win as long as the United States can intervene. However, because the two countries will conflict with Japan on territorial issues, the two countries cannot unite when the conflict occurs, so the United States need not be afraid to deal with two countries at the same time.