The theme of this article is seen directly as a major plot point in the series Shogun.
Its quite a good show!
And an even better book, which is a part of an excellent series spanning centuries and Singapore, Hong Kong, Iran, and many other places.
Loved that show. There is a fairly recent "Last Samurai Standing" fictional series that portrays the desperation of the Samurai after the end of the Edo era. It's a bit Squid Game-ish, but I enjoyed it immensely.
Shogun describes the period just before the establishment of the Tokugawa shogunate. This article describes the system that developed after that, under the Shoguns.