NES games surpassing Master System on a technical level wasn't just a matter of developers getting better but also because NES carts were using a lot of chips to enhance the games as well.
The N64 using cartridges didn't really affect the length or complexity of its games. Look at how many cartridge games prior to the N64 that take dozens and dozens of hours to complete. Easily as long as the average length of a PS1 RPG. The extra space on PS1 discs was usually used on things like FMV, prerendered backgrounds, redbook audio, and other things that don't really contribute to the length of a game or complexity. The Dragon Warrior games on NES can take a long time to beat, and they're a tiny fraction of the size of any 5th gen game. But I do agree that PS1 was the best balance of power and price for its gen. The N64 wasn't particularly expensive, but I believe the PS1 was the same price or cheaper when the N64 launched, and if one was buying games at full MSRP, $60 for each N64 game adds up versus $40 for the average PS1 game.