First of all, When modifying the url permalink structure it is best practice to flush the rewrite rules using the Wordpress flush_rewrite_rules() function.
Remove rewrite rules and then recreate rewrite rules.
You're actually on the right track, indeed you need to use /%category%/%postname%/ in your custom permalink structure.
For the purpose of this example, let's declare two categories, a parent and a child, Fruits and Tomatoes.
Fruits
└── Tomatoes
Wordpress uses the hierarchical alphabetical order to choose which category will be used in the url permalink structure. By default Wordpress can't display more than 1 category per level.
| Behaviour |
Description |
|---|
| Possible |
eg: domain.com/parent/child/grand-child/my-first-post/ |
| NOT Possible |
eg: domain.com/parent-1/parent-2/my-first-post/ |
If we want our url to be domain.com/fruits/my-first-post/ we need AT LEAST to select the fruits category.
If we want our url to be domain.com/fruits/tomatoes/my-first-post/ we need to select the tomatoes category ONLY.
On your end, you simply need to unselect yhe top level categories associated with your child category and you should be good to go.